SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Mar 2001
    Location
    Panhandle of Florida (White Sand/Brown Skin)
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    trying to build a page that loads one of four random images in the top of the page...

    can anyone refer me to the best mathod of doing this?
    and a tutorial maybe?

    thanks!!!

    -SeFu-

  2. #2
    SitePoint Zealot
    Join Date
    Mar 2001
    Location
    Panhandle of Florida (White Sand/Brown Skin)
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what am i doing wrong here???

    Code:
    <script language="JavaScript">
      TopLogo1 = new Image();
      TopLogo1.src = "images/top_right.gif";
      TopLogo2 = new Image();
      TopLogo2.src = "images/top_right2.gif";
      TopLogo3 = new Image();
      TopLogo3.src = "images/top_right3.gif";
    
    var TopRight = new Array(2)
    TopRight[0] = TopLogo1
    TopRight[1] = TopLogo2
    TopRight[2] = TopLogo1
    
    var randomNumber = Math.floor(Math.random()*10);
    var modNumber = randomNumber %3;
    </script>
    
    <body>
    <table valign="top" width="100%" cellpadding="0" cellspacing="0" border="0">
    <tr>
    	<td align="left" width="149"><img src="images/top_left.gif" width=149 height=153 border=0 alt="East Coast Customs Car Club"></td>
    	<td background="images/top_bground.gif" width="100%"><br></td>
    	<script language="JavaScript">
    	document.write("<td align='right' width='258'><img src=' " + TopRight[modNumber] + "width=258 height=153 border=0 alt=''></td>")
    	</script>
    </tr>
    </table>
    I tried to make the javascript write only one table column so that if someone isnt able to view javascript then that column would just load a blank image (i think) and the column to the left of it would simple repeat the background to fill in the rest.

    but for some reason... when i load this page, i get a no show image in the top right...
    anyone have a idea on what im doing wrong?

    thanks!

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2001
    Location
    Panhandle of Florida (White Sand/Brown Skin)
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i found it...
    i spelled Array "Arraoy" lol


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •