You are on page 1of 6

***Few JavaScript program from or inspired by JavaScript and Jscript book of James Jaworski *** 1- <html> <head> <title>Heading,

Paragraph, Variable & hyperlink of page 9 of JavaScript by James Jaworski </title> <script language="Javascript"> document.write ("<H1> First Heading </H1>") </script> <body><!-- This is comment --> <h1>Second Heading</h1> <p>First Paragraph</p> <script> /* var a = prompt ("Enter Your Name"); document.write ("My Name: "+a); document.write ("<P> Second Paragraph</P>") */ </script> <a href="http://www.google.com">Click here for webpage</a> <a href="E:\">Click here to navigate to a specified location</a> </body> </html> *-*-*-*-* 2- <html> <head>

<title> JavaScript 'Hyperlink' of page 43 of JavaScript by James Jaworski </title> <script language ="JavaScript"> </script> </head> <body> <a href="http://www.google.com">Click Hyperlink to open website</a> <a href ="&amp;(linkTo);" ></a> </body> </html> *-*-*-*-* 3- <html> <head> <title>Conversion between types, Quotes, Formatting characters of page 57 of JavaScript by James Jaworski </title> </head> <body> <script language ="JavaScript"> document.write("true*5+false*7=") document.write(true*5+false*7) /*document.write("Use backslash for double quote \" Hmmmm... \"") document.write("<BR>") document.write("<BR>") document.write(eval ("12.34*10"))*/ </script> </body>

</html> *-*-*-*-* 4- <html> <head> <title> Creating HTML Tag of page 47 of JavaScript by James Jaworski </title> <script LANGUAGE ="JavaScript"> greeting = "<H1> Hi </H1>" welcome = "<P> Welcome</p>" </script> </head> <body> <script LANGUAGE ="JavaScript"> document.write(greeting) document.write(welcome) </script> </body> </html>

*-*-*-*-* 5- <html> <head> <title>Number Types of page 54 of JavaScript by James Jaworski </title> </head> <body>

<script language ="JavaScript"> document.write("0xab0 + 0xcd =") document.write(0xab0 + 0xcd) document.write("<BR>") document.write("<BR>") document.write("<BR>") document.write (-4.321e18) </script> </body> </html> *-*-*-*-* 6- <html> <head> <title>Different Types of arrays of page 70 of JavaScript by James Jaworski</title> </head> <body> <script language ="JavaScript"> /* employee = new Array(2) employee [0] = 'Bill' employee [1] = 'Bo' document.write(employee [0]+"<br>") document.write(employee [1]+"<br>") Line 16*/ //Extending length of array order = new Array() document.write("order.length = "+order.length+"<br> <br>") order [999]= "Check" document.write("order.length ="+order.length)

</script> </body> </html> *-*-*-*-* Frames *-*-*-*-* /* Frames in JavaScript */ /* 1st frame code http://www.pageresource.com/html/frame1.htm */ <HTML> <HEAD> <TITLE>JavaScript Example 13</TITLE> </HEAD> <BODY> <FORM> <INPUT type="button" value="What is cool?" onClick="parent.right_frame.document.form1.text1.value='Me!'"> </FORM> </BODY> </HTML> /* 2nd frame code */ <HTML> <HEAD> <TITLE>JavaScript Example 14</TITLE> </HEAD> <BODY> <FORM name="form1"> <INPUT type="text" name="text1" size="25" value=""> </FORM> </BODY> </HTML> /* Merger of the 2 above frames */ <HTML> <HEAD> <TITLE>Frames Values http://www.pageresource.com/jscript/jframe1.htm</TITLE> </HEAD> <FRAMESET cols="20%,80%"> <FRAME SRC="1.html" name="left_frame"> <FRAME SRC="2.html" name="right_frame"> </FRAMESET> </HTML>

You might also like