WEBVTT 00:00:07.580 --> 00:00:11.250 In this video we're going to get introduced to javascript's. 00:00:11.250 --> 00:00:13.010 So what is javascript. 00:00:13.200 --> 00:00:23.280 Javascript is a computer programming language that is used to create scripts for a shemale documents 00:00:24.120 --> 00:00:33.390 and it's usually used to create some interactive effects which will make the user experience more interactive 00:00:33.390 --> 00:00:34.470 with the web browser. 00:00:34.650 --> 00:00:38.650 So that will be able to change a shemale content for instance. 00:00:38.660 --> 00:00:42.480 So they can change styles. 00:00:42.570 --> 00:00:50.010 All right so we're going to be creating our first example in this session and before we do that we're 00:00:50.010 --> 00:00:55.430 going to create our javascript's folder in the products folder. 00:00:55.710 --> 00:00:57.000 So we're going to call the javascript's 00:01:04.720 --> 00:01:07.830 and let's open it using brackets 00:01:15.470 --> 00:01:19.040 right now. 00:01:19.710 --> 00:01:22.090 What we want to create. 00:01:22.080 --> 00:01:30.720 Here is a web page that will sue and alerts message when loaded. 00:01:30.750 --> 00:01:34.000 So basically we're going to need to create a shemale file. 00:01:34.630 --> 00:01:40.500 It's call it alerts message. 00:01:40.510 --> 00:01:46.950 And then inside the file We're going to need to create our javascript's code so the code is imbedded 00:01:47.310 --> 00:01:49.400 in the e-mail file. 00:01:49.700 --> 00:01:50.160 OK. 00:01:50.520 --> 00:01:53.390 So we create our web page from scratch. 00:01:53.760 --> 00:01:56.280 So we sat with our talk site 00:01:58.880 --> 00:02:13.290 because we will set a shemale and have a simple section and inside this we can have the head section 00:02:15.660 --> 00:02:20.350 of the body section. 00:02:20.350 --> 00:02:32.520 OK so if we had let's have a meta character sets the stage UTF 8 let's have a title 00:02:35.550 --> 00:02:39.640 Let's call these alerts message. 00:02:40.580 --> 00:02:50.130 Now go to the body let's define a paragraph and have some text in its javascript. 00:02:53.520 --> 00:02:54.340 All right. 00:02:54.550 --> 00:03:05.120 OK so now we want to create some code that will show up a alerts message when the page is loaded. 00:03:05.790 --> 00:03:08.610 So we're going to need some javascript's code. 00:03:08.610 --> 00:03:14.120 Basically there are several ways of doing this so we can write the code inside the head Arameans. 00:03:14.250 --> 00:03:17.890 Also we can write it inside the body elements. 00:03:18.110 --> 00:03:21.860 The one good way is to write it in the body elements. 00:03:21.870 --> 00:03:28.350 So we have a choice between writing it at the beginning of the body or at the end just before the close 00:03:28.350 --> 00:03:28.770 second. 00:03:28.770 --> 00:03:32.850 The best way is to write the javascript code just before the close. 00:03:33.090 --> 00:03:43.800 The reason why is we want the web page to load first and then we want the code to be executed to avoid 00:03:43.830 --> 00:03:44.870 any delays. 00:03:45.140 --> 00:03:45.740 OK. 00:03:46.290 --> 00:03:48.440 So the syntax is simple. 00:03:48.480 --> 00:03:51.280 We're going to need a script tag. 00:03:52.500 --> 00:03:53.160 OK. 00:03:53.490 --> 00:04:00.770 And then we write our code inside the script like you may want to add an attribute to the script to 00:04:00.790 --> 00:04:08.130 do the script tag showing the type of the scripting language you are using by default is javascript 00:04:08.130 --> 00:04:09.210 so you don't have to. 00:04:09.310 --> 00:04:11.190 Are these attributes but if you want to. 00:04:11.430 --> 00:04:14.760 The syntax is of type 00:04:18.740 --> 00:04:19.440 and 00:04:22.740 --> 00:04:23.460 basically 00:04:26.190 --> 00:04:28.320 it's going to be text 00:04:33.220 --> 00:04:36.520 javascript. 00:04:39.110 --> 00:04:43.180 OK. 00:04:43.230 --> 00:04:43.520 All right. 00:04:43.530 --> 00:04:46.650 And now let's write our code. 00:04:46.830 --> 00:04:55.350 Basically javascript's consists of statements so a statement is a piece of code followed by a semicolon 00:04:55.360 --> 00:04:55.930 . 00:04:56.490 --> 00:05:05.610 So in our case we're going to use a function called the alert level function and we're going to need 00:05:05.640 --> 00:05:11.930 a string inside the brackets of this function and then we need to pull out by a semicolon. 00:05:11.940 --> 00:05:24.480 So let's choose a string as we put it between double quotes and it's always welcome to Javascript. 00:05:24.930 --> 00:05:30.180 So we are expected to see this message show up when the page is loaded. 00:05:30.750 --> 00:05:34.760 So just I'm just going to save the code control as. 00:05:35.250 --> 00:05:36.180 OK. 00:05:36.990 --> 00:05:39.570 Now let's refresh the page. 00:05:39.920 --> 00:05:44.580 And as you see we getting a alerts message. 00:05:44.580 --> 00:05:47.160 Welcome to javascript's. 00:05:47.160 --> 00:05:51.710 All right. 00:05:52.770 --> 00:05:59.750 OK so now we're going to try to use external javascript so we can put out code in an excel file and 00:05:59.750 --> 00:06:05.460 then we will need to link our a shemale file to the Excel file to run the code. 00:06:05.640 --> 00:06:10.660 So let's create a new folder inside javascript's. 00:06:11.940 --> 00:06:14.000 This call is genius. 00:06:14.010 --> 00:06:19.180 And then inside this file they're going to create a new file that's going to be a job askers file. 00:06:19.200 --> 00:06:21.940 We're going to call this code taught to yes. 00:06:22.340 --> 00:06:23.060 OK. 00:06:23.480 --> 00:06:28.910 And we're going to do we just going to take these statements only the code we don't need the script 00:06:28.920 --> 00:06:30.690 tag only the code. 00:06:30.690 --> 00:06:32.910 Are we going to base it there. 00:06:33.360 --> 00:06:34.390 OK. 00:06:34.980 --> 00:06:37.830 So control is to save. 00:06:38.970 --> 00:06:44.710 OK so you've got a error showing they're going to come back in a bit. 00:06:44.730 --> 00:06:48.960 So for now we're just going to delete this statesman's. 00:06:48.960 --> 00:06:58.260 We don't need the code anymore at all we need is a source attribute to tell the browser where is the 00:06:58.260 --> 00:06:59.340 Excel javascript. 00:06:59.360 --> 00:07:05.310 OK so it's going to be tedious for Slash code to trace. 00:07:05.430 --> 00:07:10.960 OK so let's go back to our jobs Gerbs file and deal with this error. 00:07:10.960 --> 00:07:18.790 So what the error is saying is saying that the alerts function was used before it was defined. 00:07:18.810 --> 00:07:26.160 And the reason why we get this error is because alerts is actually a method of an object we know. 00:07:26.340 --> 00:07:29.980 And the sun is a little bit more when we cover objects. 00:07:30.240 --> 00:07:36.490 So normally as Ilya's is a method of objects which means that is a function of an object. 00:07:36.510 --> 00:07:43.110 We need to specify what objects we are talking about which is window. 00:07:43.140 --> 00:07:52.740 In our case basically two objects window as got some methods and one of the methods is a let's add a 00:07:52.740 --> 00:08:01.200 way to do that is by going objects thought method or function like this. 00:08:01.200 --> 00:08:07.020 OK so now if free if we save control as we'll see that the error disappears. 00:08:07.770 --> 00:08:17.970 OK so basically we don't have to use these full syntax only alerts will work OK but it is better if 00:08:17.970 --> 00:08:20.300 we have the holding window doors. 00:08:20.330 --> 00:08:20.940 Or let's. 00:08:21.270 --> 00:08:25.460 OK so if you refresh the page we can see that actually this is working. 00:08:25.800 --> 00:08:26.450 OK. 00:08:26.730 --> 00:08:31.060 So this is how javascript's works in the next video. 00:08:31.170 --> 00:08:34.500 We will start looking at Buttons