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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Random Image with map

    Hello,

    I used the thread at:
    Random Image Map needs links

    to do this and it works fine in safari, but in internet explorer or firefox the images do not show up. Could someone help?

    The page is at flourisheveryday.com and here's my code:

    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    
    var myStrip = new Array()
    myStrip[0]=['UserMods/template/home_large_09.png']
    myStrip[1]=['UserMods/template/home_large_08.png']
    myStrip[2]=['UserMods/template/home_large_07.png']
    myStrip[3]=['UserMods/template/home_large_05.png']
    myStrip[4]=['UserMods/template/home_large_10.png']
    myStrip[5]=['UserMods/template/home_large_11.png']
    myStrip[6]=['UserMods/template/home_large_12.png'];
    
    var imgCt = myStrip.length;
    var randomNum = Math.floor((Math.random() * 7));
    var myMap = "#Map" + String(randomNum);
    
    function chooseStrip() {
    if (document.images) {
    document.strip.src = myStrip[randomNum];
    document.getElementById('strip').useMap = myMap;
    }
    }
    
    //-->
    </script>
    
    <body onload="chooseStrip();">
    
    <IMG SRC="UserMods/template/home_blank.png" NAME="strip" border="0" width=440 height=508 USEMAP="#Map0" ID="strip">
    
    <MAP NAME="Map0" ID="Map0">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map1" ID="Map1">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map2" ID="Map2">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map3" ID="Map3">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map4" ID="Map4">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map5" ID="Map5">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map6" ID="Map6">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,511
    Thanks
    3
    Thanked 504 Times in 491 Posts
    var myMap = "#Map" + randomNum;
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    still no dice...

    it doesn't seem to load the random images, only the "home_blank.png"

  • #4
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,511
    Thanks
    3
    Thanked 504 Times in 491 Posts
    Code:
    <script language="JavaScript" type="text/javascript">
    <!--
    var path='http://www.vicsjavascripts.org.uk/StdImages/';
    
    var myStrip = new Array()
    myStrip[0]=[path+'One.gif']
    myStrip[1]=[path+'Two.gif']
    myStrip[2]=[path+'Three.gif']
    myStrip[3]=[path+'Four.gif']
    myStrip[4]=[path+'Five.gif']
    myStrip[5]=[path+'Six.gif']
    myStrip[6]=[path+'Seven.gif'];
    
    var imgCt = myStrip.length;
    var randomNum = Math.floor((Math.random() * 7));
    var myMap = "#Map" + randomNum;
    
    function chooseStrip() {
     document.getElementById('strip').src = myStrip[randomNum];
     document.getElementById('strip').useMap=myMap;
    }
    
    //-->
    </script>
    
    <body onload="chooseStrip();">
    
    <IMG SRC="UserMods/template/home_blank.png" NAME="strip" border="0" width=440 height=508 USEMAP="#Map0" ID="strip">
    
    <MAP NAME="Map0" ID="Map0">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map1" ID="Map1">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map2" ID="Map2">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map3" ID="Map3">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map4" ID="Map4">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map5" ID="Map5">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    
    <MAP NAME="Map6" ID="Map6">
    <AREA SHAPE="RECT" COORDS="131,473,352,493" HREF="scripts">
    </MAP>
    </body>
    </html>
    this works with IE and FF

    maybe your images or image type.
    Vic

    God Loves You and will never love you less.

    http://www.vicsjavascripts.org/Home.htm

    If my post has been useful please donate to http://www.operationsmile.org.uk/


  •  

    Posting Permissions

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