How to use a for loop in javascipt Hi Guys, in this tutorial i will let you now how to use a for loop in javascript.This if very helpful in web application development. Code:- <html> <body> <script type="text/javascript"> var i=0; for (i=1;i<=10;i++) { document.write("Number " + i); document.write("<br />"); } </script> </body> </html>
Category: Javascript
How to use If Else condition in Javascript 1. if statement – use this statement to execute some code only if condition is true then else condition is excluded. 2. if…else statement – use this statement to execute some code when if condition is wrong on this condition else code run. Code:- <script type="text/javascript"> var […]
How to create a alert box in html through javascript In html through javascript you can also use alert message by the sample code present below.It is easy to use and also easy to edit. Code:- <html> <head> <script type="text/javascript"> function alert() { alert("Hightechnology!"); } </script> </head> <body> <input type="button" onclick="alert()" value="Hightechnology" /> </body> </html>
Here a sample code is present to show date on your html page. This is helpful for users who don’t know javascript. Code:- <html> <body> <h1>Hightechnology</h1> <p id=”hightech”>Hi</p> <script type=”text/javascript”> document.getElementById(“hightech”).innerHTML=Date(); </script> </body> </html>