Submitted by: Submitted by test3112
Views: 270
Words: 432
Pages: 2
Category: Science and Technology
Date Submitted: 04/23/2012 06:18 AM
Prepared by Rathod Vijay P.
Mo.98259 62615
Java script
Using java script in the html format.
Syntax:
} statement block
Eg.
This is first java program WelCome document.write("Hello...");
* White space
Example of white space
Name=” Hardik”
Page 1 of 60
Prepared by Rathod Vijay P.
Mo.98259 62615
* Inserting Special Characters Example of white space
This is first java program WelCome document.write("Hello..\ R you \"Fine ?");
* Inserting Comment in Java script Example of Comment
This is first java program WelCome // Single line Comment document.write("Hello..\ You r \"Fine ?"); /*This is double line comment*/
Page 2 of 60
Prepared by Rathod Vijay P.
Mo.98259 62615
*using backslash
INSET SPECIAL CHARACTERS WELCOME document.write("YOU \& GAUTAM SING \"HAPPY BIRTHDAY\".");
Page 3 of 60
Prepared by Rathod Vijay P.
Mo.98259 62615
* Variable in Java Script
Variable scope in Java Script In short we can create local variable in the function, and we can create global variable in the script tag it will destroyed when the page is close.
Dialog boxes 1). Alert
Used to display any message on screen.
Syntax: alert(“message/text”);
example:
This is testing of alert WelCome alert("This is testing of alert");
Page 4 of 60
Prepared by Rathod Vijay P.
Mo.98259 62615
2). conform
To display any message on screen and gets input in form of yes and no.
Syntax: conform(“message/text”);
example:
This is testing of alert WelCome
if(confirm("Are you shore do you want to continue...?")) { alert("Your answer will display in few time..."); document.write(""); } else { alert("Your answer will not display in few time..."); document.write(""); }
Page 5 of 60
Prepared by Rathod Vijay P.
Mo.98259 62615
3). prompt
To get any details from the user.
Syntax: Var =prompt(“message/text”,”default value”);
s example:
This is...