C# Programming: Javascript Function in very easy way

Saturday, January 9, 2016

Javascript Function in very easy way

Welcome to another Javascript Tutorial on Function. Function is just a bunch of codes given a name.
Lets start making a function in this tutorial. Write following line of code in notepad or any editor and save as dot html (myfunction.html).

<html>
<head>
<title>Script in head section</title>
<script type="text/javascript">      
function message()               
{
alert("This alert box was called with the onload event"); 
}
</script>
</head>

<body onLoad="message()">      


</body>
</html>

Here script tag start our javascript.
function keyword is use to make function. Here message is our function.
alert is another pre built function to show message.
Message Function will execute upon a page load.
Now start that file with any browser and see the magic :)

You can watch following video for above stuff.

No comments:

Post a Comment