The HTML code for scriptfivedrill.html
 
 

In the framed box at the bottom of the page is the code that generates the page scriptfivedrill.html.
The first eight lines, seen below
 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.51 (Macintosh; U; PPC) [Netscape]">
   <title>Quiz on the Symbols of Elements Using Script Five</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#551A8B" alink="#0000FF" >

are  necessary to generate a page in HTML. If you use your own editor to create your page, this code  will change. I have underlined the line that creates the title of the page.

Likewise you must end the page with </body>  </html>
 

Notice the <form> command is included before the javascripts and the <form> after the last one. I have used the same color coding below as in the overall listing of the javascripts found here.

Notice how the variables (the names that the buttons display and the preprogrammed responses are in red, while the preprogrammed answer is in blue. Notice how we have simply copied the script found  here for Script Five, five times, added some text and formatting commands ( <br>), and changed the variables that define the responses and the answer.
 
 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.51 (Macintosh; U; PPC) [Netscape]">
   <title>Quiz on the Symbols of Elements Using Script Five</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#551A8B" alink="#0000FF" >
 

<form>

<center><big> Quiz on the symbols of the elements.</big></center><br><br>

Click on button and, at the prompt, give the element that corresponds to the abbreviation
on the button. <br>Use only lower-case letters. Do not use extra spaces. <br><br>

1. <input type="button" value="Pb. " 
                  onClick="var hh = prompt(' Write the answer and click OK.','');
                  if( hh == 'lead'        )
                 {
                 alert('Yesssss!!!');}
                        else 
                 alert('No.  The answer is: lead');">

 <br><br> 

2. <input type="button" value="Au. " 
                  onClick="var hh = prompt(' Write the answer and click OK.','');
                  if( hh == 'gold'        )
                 {
                 alert('Yesssss!!!');}
                        else 
                 alert('No.  The answer is: gold');">

 <br><br> 
 

3. <input type="button" value="Ag. " 
                  onClick="var hh = prompt(' Write the answer and click OK.','');
                  if( hh == 'silver'        )
                 {
                 alert('Yesssss!!!');}
                        else 
                 alert('No.  The answer is: silver');">

  <br><br> 

4. <input type="button" value="Cu. " 
                  onClick="var hh = prompt(' Write the answer and click OK.','');
                  if( hh == 'copper'        )
                 {
                 alert('Yesssss!!!');}
                        else 
                 alert('No.  The answer is: copper');">
 <br><br> 

5. <input type="button" value="Fe. " 
                  onClick="var hh = prompt(' Write the answer and click OK.','');
                  if( hh == 'iron'        )
                 {
                 alert('Yesssss!!!');}
                        else 
                 alert('No.  The answer is: iron');"> 

                 <br><br> 

</form>
 

</body>
</html>
 


 

Copyright 1999 Jean Alvares

Return to Jean Alvares' Javascript Guide and Links