Monday, January 4, 2016

Javascript start from Hello World for beginners

Hello guys welcome to my first tutorial on javascript. You are at right place to jumstart on javascript.
Javascript is pretty much easy with some one's little guidance. Lets start our first program on javascript i.e Hello world program.

What this program or script does?
This hello world script display a hello world message in alert box. It display in two way one is directly on opening page and another on clicking on a button.

How it works?
It works with following code , just type it in notepad. Remember later we may have different editing tools for now you can practice in notepad or notepad++.The code is:
<html>
<head>
<title>
Javascript
</title>
<script>
function sayhello()
{
alert("Hello World");
}
</script>
</head>
<body>
<button onclick="sayhello()">Click It</button>
</body>
</html>

Here html tag starts our html page.
Head is a thinking part of our page which does logical work. It may contain scripts titles or css.
Title creates a page title 'Javascript'.
Script is starting our javascript.In which we can write our function or javascript codes.
Body is main or parent part of our page in which physical or visible things appear. Like here is a button.
Button tag is making a button. It contains a attribute called onclick which enables you to launch a function.

Finally
Thus on clicking that button sayhello function of script section executes and a alert box appers saying Hello world.

Thank you for visiting this javascript blog if any question or doubts you have you are free to write comment or message me.
Fb:https://fb.com/ythecoder
Youtube: https://www.youtube.com/watch?v=Vj_2I7Csk78

                                           You can watch this youtube video if you like.



No comments:

Post a Comment