• Log in or sign up for an account here: https://www.sythe.org/login

JavaScript Help

AfterLyfe

Forum Addict
Joined
Sep 23, 2010
Sythe Gold
0
Messages
391
Location
PA
Code:
<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- 
   New Perspectives on JavaScript, 2nd Edition
   Tutorial 1
   Review Assignment

   Monroe Public Library
   Author: thomas balaban
   Date:   Jan 14th

   Filename:         mpl2.htm
   Supporting files: mpl2.jpg, mplstyles.css, random.js, 0.jpg - 9.jpg
-->

   <title>Monroe Public Library</title>
   <link href="mplstyles.css" rel="stylesheet" type="text/css" />
[COLOR="Cyan"]   <script src="random.js" type= "text/javascript">
   </script>[/COLOR]
   
[COLOR="Cyan"]   <script type="text/javscript">
   /* The showImg() function displays a random image from the 0.jpg through 0.jpg files.
     The random image is designed to thwart hackers attmpting to enter the library records database by requiring visual confirmation
	 */
	 
	 
   function randomImg() {
   var imgNumber = randomInteger(9);
   return randomInteger();
   <img src='imgNumber.jpg' alt='' />
   }
   
   /* returns a random number from 0 to 9. */
   
   
   </script>[/COLOR]
</head>

<body>
<div id="pageContent">
   <div id="head">
      <img src="mpl.jpg" alt="Monroe Public Library" />
   </div>

   <div id="links">
      <span>Quick Links</span>
      <a href="#">Home Page</a>
      <a href="#">Online Catalog</a>
      <a href="#">Friends of MPL</a>
      <a href="#">New Books and Other Good Reading</a>
      <a href="#">Ohio Virtual Library</a>
      <a href="#">Internet Public Library</a>
      <a href="#">Services and Collection</a>
      <a href="#">Adult Programs</a>
      <a href="#">Teen Central</a>
      <a href="#">Children's Room</a>
      <a href="#">Computers at MPL</a>
      <a href="#">Computer Rules and Procedures</a>
      <a href="#">Staff Directory</a>
      <a href="#">Library Records</a>
   </div>

   <div id="main">
      <h2>Library Records</h2>
      <p>To view the library records, enter your username and password.</p>

      <table border="1" cellpadding="5" cellspacing="0">
         <tr>
            <th>Username</th>
            <td><input size="20" /></td>
         </tr>
         <tr>	
            <th>Password</th>
            <td><input type="password" size="20" /></td>
         </tr>
         <tr>
            <td>As a final security check, enter the 5 numbers 
                you see displayed below.</td>
            <td><input size="6" /></td>
         </tr>
         <tr>
            <td colspan="2" class="center">
            <input type="button" value="View Library Records" />
            </td>
         </tr>
         <tr>
            <td colspan="2" class="center">
			
[COLOR="Cyan"]			<script type="text/javascript">
			showImg();
			showImg();
			showImg();
			showImg();
			showImg();
			</script>[/COLOR]
			
            </td>
         </tr>
		 
      </table>
   </div>

   <address>
      <b>Monroe Public Library</b>
      580 Main Street, Monroe, OH &nbsp;&nbsp;45050
      <b>Phone</b>(513) 555-0211 begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting begin_of_the_skype_highlighting**************(513) 555-0211******end_of_the_skype_highlighting  
      <b>Fax</b>(513) 555-0241
   </address>
   
</div>       

</body>
</html>


This is the first javascript I have ever done and tbh I feel its too advanced for a complete noob.

I am suppose to try to display 5 images out of jpgs 1-9.

All 5 displayed are suppose to be random. I have no idea how to do it and been going through the book trying different things for like a hour now.

highlighted the parts I am working on in blue
 
Runescape Gamblingrunescape gambling
Back
Top