Javascript tutorials #1

Let everyone know that you\'re techy!!!

FacebookRedditEmail this page



we will learn javascript with projects like making websites,making web apps that can even run in android phones etc+++more funs.

so, without here and there about its uses; this and that; let’s start to learn the basics.

We will write the first program to display the sth in the desktop.

its source code is as follows-:

what to do with this code?

paste it in notepad and save as javascript1.html. then test the output.

it will come like this.

So, again, we will try with something different in the above code.

till now, you  must remember the basic syntax of the code in javascript.

Now, I will do a little bit of tweak in the same code above.

i will add html tag h1 and display “home page” with the help of it.

meanwhile, i will also add another tag paragraph p, with which i will display “this is a paragraph”

let’s see the tweaked code.


so, that’s it.

the above code will do the above output effect.

The browser reads the code in sequence, so what it gets at first; it will display it first.

i.e here in this code, we can see that “Home Page” is at first, then “Line 1” comes; and finally comes “This is a paragraph”.

So, our next step in learning javascript is to learn to add, external javascript files of .js extension INTO the .html file.

so, make a text document; and save it as j1.js.

then, paste the below code inside it.

and then create another .html file called name.html.

then, paste this code inside it.

what is inside the code is not so important because, anyway we will be learning it later.

the main thing here is src=”j1.js” that helped to bring the j1.js file components into the .html file.

now, observe the output by running the .html file in browser.

so, we see a button showing result.

 

Share this and have a good day!

Facebook

Be the first to comment

Leave a Reply

Your email address will not be published.


*