text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
the top of the page the body tags that | 141.26 | 3.54 |
describe the structure of the page and | 143.15 | 2.94 |
then additional tags that could be | 144.8 | 3.63 |
nested within those and in order to add | 146.09 | 4.29 |
JavaScript to a web page if it's as | 148.43 | 2.76 |
simple as include | 150.38 | 3.06 |
some script tags that are often located | 151.19 | 5.79 |
inside of the HTML page itself when we | 153.44 | 5.34 |
use these script tags we're telling the | 156.98 | 3.99 |
browser that anything in between these | 158.78 | 4.14 |
script tags should be interpreted in | 160.97 | 4.41 |
this case as JavaScript code that the | 162.92 | 5.37 |
web browser is then going to execute so | 165.38 | 4.83 |
our very first program for example might | 168.29 | 3.93 |
just look like a line of code inside of | 170.21 | 3.69 |
the script tags something like this | 172.22 | 4.35 |
where alert for example is the name of a | 173.9 | 4.14 |
function a function that's going to | 176.57 | 3.99 |
produce an alert and then just as with | 178.04 | 4.05 |
functions in Python functions in | 180.56 | 3.45 |
JavaScript can take arguments so in | 182.09 | 3.69 |
between these parentheses we have an | 184.01 | 3.78 |
argument something like a string hello | 185.78 | 3.57 |
world the text that we would like to | 187.79 | 4.26 |
display to the user so let's go ahead | 189.35 | 4.56 |
and give this a try and see how we can | 192.05 | 3.57 |
actually use this code to write | 193.91 | 3.93 |
JavaScript that is going to run inside | 195.62 | 4.56 |
of the user's web browser I'll go ahead | 197.84 | 4.44 |
and create a new file that will call | 200.18 | 6.23 |
hello HTML and inside of it I'll include | 202.28 | 8.01 |
the same basic HTML structure that we've | 206.41 | 5.38 |
already seen before where I have a head | 210.29 | 3.51 |
section that has a title and then a body | 211.79 | 4.61 |
that maybe just says hello for example | 213.8 | 5.82 |
and so now what I'd like to do is add a | 216.4 | 5.14 |
little bit of JavaScript to this web | 219.62 | 4.14 |
page so in the head section of my web | 221.54 | 4.8 |
page I'm gonna go ahead and add a script | 223.76 | 5.07 |
tag we're in between these script tags | 226.34 | 5.22 |
now I can write JavaScript code code | 228.83 | 3.6 |
that is going to be written in | 231.56 | 2.85 |
JavaScript that will run inside of the | 232.43 | 4.38 |
web browser when the user actually opens | 234.41 | 4.23 |
up this page and for now I'll just say | 236.81 | 6.24 |
alert and then hello world it turns out | 238.64 | 6.21 |
in JavaScript you can use either single | 243.05 | 3.45 |
quotation marks or double quotation | 244.85 | 3.21 |
marks in order to represent strings and | 246.5 | 3.48 |
I'll generally use single quotation | 248.06 | 4.17 |
marks here just by convention so here | 249.98 | 3.479 |
I'm running a function called alert | 252.23 | 2.46 |
that's going to display an alert | 253.459 | 2.791 |
something like hello world to the user | 254.69 | 3.96 |
and that's going to be inside of the | 256.25 | 6.69 |
script tags of this HTML page so now if | 258.65 | 6.39 |
I want to actually open the page up I | 262.94 | 4.32 |
can open hello dot HTML or you could | 265.04 | 3.6 |
just visit it inside of your web browser | 267.26 | 2.7 |
whether it's Chrome or something else | 268.64 | 3.39 |
and now at the top of the page what | 269.96 | 3.63 |
you'll notice is that I get a little bit | 272.03 | 3.75 |
of an alert some interaction where it | 273.59 | 4.35 |
says this page says hello world and | 275.78 | 3.48 |
gives me an option to like press a | 277.94 | 3.599 |
button for example like Hello I'd like | 279.26 | 3.75 |
the OK button that'll say all right | 281.539 | 2.851 |
dismiss the alert now | 283.01 | 3.09 |
and this is our very first example of | 284.39 | 2.94 |
JavaScript we have a function called | 286.1 | 3.45 |
alert built into JavaScript for our web | 287.33 | 3.96 |
browser and our web browser knows that | 289.55 | 3.48 |
when we call the alert function the | 291.29 | 3.6 |
browser should display an alert message | 293.03 | 3.72 |
that looks a little something like that | 294.89 | 3.75 |
and if i click the ok' button to dismiss | 296.75 | 3.9 |
the alert then we go ahead and get back | 298.64 | 4.41 |
the original page that i had from the | 300.65 | 5.4 |
beginning and so now we can begin to | 303.05 | 4.98 |
imagine that using this ability to | 306.05 | 4.11 |
programmatically display alerts that we | 308.03 | 4.11 |
can add additional features to our | 310.16 | 4.17 |
applications as well and one big area | 312.14 | 3.57 |
where javascript can be quite powerful | 314.33 | 3.81 |
is with isn't driven programming and | 315.71 | 3.96 |
what event-driven programming is all | 318.14 | 3.45 |
about is thinking about things that | 319.67 | 4.14 |
happen on the web in terms of events | 321.59 | 4.29 |
that happen what are some examples of | 323.81 | 4.08 |
events events are things like the user | 325.88 | 4.38 |
clicks on a button or the user selects | 327.89 | 4.02 |
something from a drop-down list or the | 330.26 | 3.6 |
user Scrolls through a list or submits a | 331.91 | 3.78 |
form anything the user does and can | 333.86 | 3.54 |
generally be thought of as an event and | 335.69 | 4.05 |
what we can do with javascript is add | 337.4 | 4.98 |
event listeners or event handlers things | 339.74 | 5.1 |
that say when an event happens go ahead | 342.38 | 4.74 |
and run this particular block of code or | 344.84 | 4.74 |
this function for example and using that | 347.12 | 4.26 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.