31 users online (0 members and 31 guests)  


  Results 1 to 3 of 3

Related

  1. Replies: 5
  2. Replies: 0
  3. Need Help With Javascript Rollover Images Pronto!    Forum: Javascript Forum
    Replies: 11
  4. Pre-Loading Rollover Javascript Images...    Forum: Javascript Forum
    Replies: 6
  1. #1
    skadrummer01's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Mar 2004
    Posts
    36

    Need help with Javascript images! HELP!

    Ok, im a web designer and all that jazz. I recently got a code for making the image change every time you visit a webpage. Thats cool and all, but I need it so that you can click the image ( or in other words a hyperlink image) and you can enter the website. Basically all I need is another code for when you go to the website, the image changes everytime you visit, and you can click the image and it will also allow you to go into the website itself.

    If anyone can help me at all that would be fantastic... wether its giving me a code or a source on the web with a code...please help, it would be greatly appreciated!

    This is the script im using so far...

    <SCRIPT LANGUAGE="JavaScript">

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

    <!-- Begin
    // Set up the image files to be used.
    var theImages = new Array() // do not change this
    // To add more image files, continue with the
    // pattern below, adding to the array.

    theImages[0] ='independent.JPG'
    theImages[1] = 'open1.JPG'
    theImages[2] = 'open2.JPG'
    theImages[3] = 'homepic.JPG'

    // do not edit anything below this line

    var j = 0
    var p = theImages.length;
    var preBuffer = new Array()
    for (i = 0; i < p; i++){
    preBuffer[i] = new Image()
    preBuffer[i].src = theImages[i]
    }
    var whichImage = Math.round(Math.random()*(p-1));
    function showImage(){
    document.write('<img src="'+theImages[whichImage]+'">');
    }

    // End -->
    </script>

    </HEAD>

    <!-- STEP TWO: Copy this code into the BODY of your HTML document -->

    <BODY>

    <SCRIPT LANGUAGE="JavaScript">

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

    <!-- Begin
    showImage();
    // End -->
    </script>

    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    </body>
    </html>


    The link to this page is...

    www.freewebs.com/zombiehunting/creativepage.html

    That should work, but im trying to get it so you can click the image too and open the page up... not working...
    Last edited by skadrummer01; 09-22-2004 at 10:39 AM.

  2. #2
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there there skadrummer01,

    I'm not sure from your post, if you wish to to go to different pages for each image or just one.

    If it is the latter, change this line...
    Code:
    document.write('<img src="'+theImages[whichImage]+'">');
    ...to
    Code:
    document.write('<a href="http://www.google.com"><img src=" '+theImages[whichImage]+' "border="0"></a>');
    ...just change the link shown in red to suit your needs.

  3. #3
    skadrummer01's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Mar 2004
    Posts
    36
    Yeah thanks a lot! it worked out wonderfully! thanks so much!

    to view go to...

    www.freewebs.com/zombiehunting/index.htm



Tags for this Thread