oh my god girl i am so tired. this is probably not the time to be learning javascript. but you know what they say. all's well that's end well. does that apply in this situation. not really. okay time to start.
alrighty. we're going to change the text in the stuff below. um. spoilers for get over the fangs and maybe the unkillable ucides i guess. and maybe body as well. (shows i have never made)
you will notice. there is a music player here. and that's really just for fun tbh
corrie: alive!
we are going to change this image of wrenny.
this is a super cool paragraph orf text. it's not even a paragraph it's two sentences and i think a paragraph is supposed to be like 3.
fuck this text.
scripts can go wherever the hell you want. in the head, in the body, in both. i don't know if there's a difference between the two or if one is better for a certain usage.
This will change if you click the button.
the function is invoked (called) when the button is pressed.
it's the exact same in the bodoy onbly it's in the body instead of the head.,
Functions are blocks of code that can be executed when "called" for. (That is paraphrased from W3.)
An example of calling a function is when an event occurs, like when the user clicks a button. That's what I've been doing with all the crazy stuff with buttons.
this text'll be changed through use of an external js file.
it seems like external js files are probably going to be better and easier than internal
external js files can be accessed through full urls, through paths, or with no path. "change the freaking text" was a path-less js reference.
there's a few different ways you can display data using javascript
inner html: using the document.getElementById( --id goes here-- ) method, you can change the data within html files without doing anything super fancy shmancy.
With this method, id refers to the HTML element being changed, while innerHTML defines the HTML content.
document.write(): if you want to test something, you can use document.write(). here is an example of document.write in action.
the "69" is created through a script tag (within the iframe), while the 420 that appears is something that's called after the document has already loaded, which is why everything disappears. i don't know if you can do more than just numbers with document.write.
you should never use document.write for anything other than testing, and for that example you just made in the cater iframe.
alert(): exactly what it says on the tin.
you can also use window.alert, but since window is the default, it's not really necessary.
console.log(): you can use this for debugging. i don't know what debugging is yet, but i'm sure we'll figure it out.
window.print(): if, for whatever asinine reason, you need to print something, you can use window.print() to print the current window's content. i don't know why you would ever use this. i don't know why you would ever use this. unless you made like activity pages or something? and you wanted to give people the option of printing them? idk dude but i mean. if you ever want to, you know you can.
alright baybee i think we're getting into math territory. and you know how great you are at math!!!!! so...... so excited i am so excited let's get pumped up. can i get a hell yeah
no don't be like that it's gonna be fun. i betcha it's not going to be like super crazy math. you'll be fine you'll be aces.
According to W3 schools, a JavaScript program is a list of instructions that the computer will execute. Separate instructions are called statements; therefore, a JavaScript program is made up of several JavaScript statements.
since we're working in html, the program will be executed by the browser. my mother is watching game of thrones downstairs and people are screaming very loudly.
Statements are composed of all kinds of things. I'll go over them when W3 goes over what they actually do.
Statements are executed in the ORDER THAT THEY ARE WRITTEN. I feel like that will be important later.
Much like CSS, statements are separated by semicolons. So long as they're separated this way, you can put statements on one line, or you can separate them to multiple lines. Knowing you, you'll probably want to do multiple lines unless it's something simpler.
white space: doesn't matter in javascript. you can separate characters or whatever with white space to make it more readable. according to w3, it's a good idea to separate operaters with white space (+, -, /, etc)
code lines longer than 80 characters can get a bit bulky. if that's the case, the best place to break it is after an operator.
statements can be grouped together in curly brackets. this is called a code block. code blocks define statements that will be executed together. oftentimes, this is used in functions.
she was NOT watching game of thrones.... she was in fact watching beetlejuice.
WHY IS MY CODE NOT SHOWING UP GRR AAGGGRR GRRRAGARGRGR
Okay we're just going to get rid of it and see what happens...
two types of javascript values:
important rules for literals:
Variables store data values. As opposed to literals? Idk
Anyways, keywords var, let, and const are used to declare variables
for example:
let x;
x=6
Expressions compute to values.
That right there? I didn't just write it. Here's what I put:
<p id="demo></p>
<script>
document.getElementById("demo").innerhtml = 5 * 10; </script>