Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Javascript w/ rotating images - not working

    Hello! I'm pretty new to webmastering in general, and brand spanking new to Javascript! I got this script off of a free resource site. It is supposed to be 9 tables. 4 cells on top, 4 cells on bottom, and one large cell spanning accross the 4. The cells are supposed to rotate, in that when you click on one of the cells (all except the large center cell) it should rotate itself into the center cell. The cell contents are loading up fine, however when you try to click on one of the cells (images) instead of putting the same image into the large center cell, the center image shows a "red x" instead of the image.

    I don't know the code well enough to understand it or to try to manipulate it. If anyone could please help me, I would be so grateful!!! Here is the coding, or you can view source at www.corradoclubmd.com/gallery.html
    (the script is still up on the page so you can see what problem I'm trying to describe).

    The code:
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original: Jenny Blewitt (webmaster@webdesignsdirect.com) -->
    <!-- Web Site: http://www.webdesignsdirect.com -->

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    browserName = navigator.appName;
    browserVer = parseInt(navigator.appVersion);

    ns3up = (browserName == "Netscape" && browserVer >= 3);
    ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);

    function doPic(imgName) {
    if (ns3up || ie4up) {
    imgOn = ("" + imgName);
    document.mainpic.src = imgOn;
    }
    }
    // End -->
    </script>
    </head>


    <body>
    <center>
    <table width=360 border=0 cellspacing=0 cellpadding=0>
    <tr>
    <td><a href="javascript:doPic('p1.jpg');"><img src="/images/nataliem/car 105.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p2.jpg');"><img src="/images/nataliem/car 106.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p3.jpg');"><img src="/images/nataliem/car 107.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p4.jpg');"><img src="/images/nataliem/interior4.jpg" width=90 height=60 border=0></a></td>
    </tr>
    <tr>
    <td colspan=4 align=center><img name="mainpic" src="/images/nataliem/car 108.jpg" width=360 height=240 border=0></td>
    </tr>
    <tr>
    <td><a href="javascript:doPic('p5.jpg');"><img src="/images/nataliem/corrado.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p6.jpg');"><img src="/images/nataliem/corrado3.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p7.jpg');"><img src="/images/nataliem/engine.jpg" width=90 height=60 border=0></a></td>
    <td><a href="javascript:doPic('p8.jpg');"><img src="/images/nataliem/Left Side.JPG" width=90 height=60 border=0></a></td>
    </tr>
    </table>
    </center>


    <!-- Script Size: 2.00 KB -->
    </body>



    Thank you thank you thank you thank you!
    Natalie

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The script is working fine, you've not put the right names for the images in place though.

    Code:
    <a href="javascript:doPic('p1.jpg');"><img src="/images/nataliem/car 105.jpg" width=90 height=60 border=0></a></td>
    The red text above points to an image that simply doesn't exist, if you replace that with the blue text which points to the image you want then the script will work (for that particular image, how to fix the rest should now be obvious though).
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #3
    New to the CF scene
    Join Date
    May 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks so much! That was pretty obvious, now I feel like a doofus!
    Thanks for taking the time to respond!


  •  

    Posting Permissions

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