Indroduction JavaScript is one of the most used Web based language.JavaScript (js) is the continuation of HTML (Hyper text markup language). There are many uses and (of course abuses) of javascript language.Here are few things that you may or may not seen in your web serfing areas Clocks Mouse trailers Drop down menus Alert messages Popup windows HTML from data validation These things are done basically with the help of java script Writing javascript Javascript program usually written on Specially text editors.Some kind of text editors are specialy build for writting HTML languages. Usually notepad,word pad are used in writing Javascript enabled files.Some text editors like G-edit are used in linux platform. After writing the HTML/javascript based files you must remember to save the text as HTML ie If your HTML file name is “index” save it as index.html.Viewing html based programmes is not a difficult task. You must have a web browser such as Windows explorer,Mozilla firefox ect So first up all lets look into a sample html programm the letters are not case sensitive you can type your program in Upper case or in lower case. Output of programm will be:-Hello world Exploring javascript Let’s find out how it works There will be one opening tag (ie) <html> is a closing tag and </html> will be its closing tag (you will pronounce it as slash html). JavaScript is an additional script used in html. So you must specify that you are using an additional script for that you must use “<sript type=”text/javascript”>” N.B if you are using other scripts you must denote it Document.write(“your text here ”) is a specific tag used in JavaScript to print texts used as input. You must close your all tabs like </script>,</head>,and </html> In some browsers JavaScript may not be enabled. You must enable the JavaScript
JavaScript is a scripting language used to make interactiveweb pages .It also known as LiveScript, JavaScript developed by Netscape with the trademark of sunmicrosystem. In Javascript we uses functions and the Functions can be defined in the <head> section and in the <body> section of a HTML document. Javascript provide the following way for implement. Code: <html> <head> <script type="text/javascript"> function show() { alert("welcome"); } </script> </head> <body> <form> <input type="button" value="Click " onclick="show()" > </form> </body> </html>
IF COMMENT IN JAVASCRIPT usualy if and if else comments are used in c/c++ languages the if statement is away to make desitions based on variable or some type of data if programm in javascript Since a=10 and its not equal to 7 output will be unlucky
Loops Loops are text printing from an integer to its next number eg 1 to 100 while loop There are two parts to javascript while loop *The conitional statements must be true for while loop's code to be executed *The while loop codes that condain curley brases {} Will be executedif condition is true When while loop begins in javascript interpreter cheakes cheaks the condition statement is true then its executed