Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    Ok I have a random image script which is attached

    But i want to be able to have a link to a different link to each image is this possible ?

    If so please edit my code and do tell ah thank you
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  2.  

  3. #2
    Senior Member skrlin's Avatar
    Join Date
    Apr 2003
    Location
    Illinois
    Posts
    562
    Member #
    1063
    be able to have a link to a different link to each image is this possible ?
    I'm not exactly sure what you are asking for here....

    Would you care to clarify ?
    - Brian

  4. #3
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    well for starters i noticed that wen i use that random image script you can actually see the image skipp through the ones which are in the script b4 selecting 1 to display....

    i wanted each image to have it's own link so .. if an image of number 1 was displayed it wud have a link to 1.html and so on

    thnx
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  5. #4
    Member sopiaz57's Avatar
    Join Date
    Sep 2003
    Posts
    41
    Member #
    3058
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Untitled</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    function dispImage() {
    var randomNum = Math.random() * 4;
    var randomNumRound = Math.round(randomNum);
    if (randomNumRound==0) {
    document.images['myPic'].src='one.gif';
    document.links[0].href = 'http://www.excite.com';
    } else if (randomNumRound==2) {
    document.images['myPic'].src='two.gif';
    document.links[0].href = 'http://www.hotmail.com';
    } else if (randomNumRound==3) {
    document.images['myPic'].src='three.gif';
    document.links[0].href = 'http://www.google.com';
    } else if (randomNumRound==4) {
    document.images['myPic'].src='four.gif';
    document.links[0].href = 'http://www.yahoo.com';
    } else {
    document.images['myPic'].src='one.gif';
    document.links[0].href = 'http://www.excite.com';
    }
    }

    //-->
    </script>
    </head>
    <body onLoad="dispImage()">

    <div align="center" style="padidng: 40px 10px 0px 10px;">
    <a href="javascript:;" > <img src="one.jpg" name="myPic" alt="A Pic"></a>
    </div>

    </body>
    </html>
    "It's very important not to embellish on your order. No extraneous comments. No questions. No compliments."
    - Jerry, in "The Soup Nazi"

  6. #5
    Member sopiaz57's Avatar
    Join Date
    Sep 2003
    Posts
    41
    Member #
    3058
    Hey and just a side note, since you have 4 images, you should multiply the random number by 3, because zero counts. 0, 1,2,3 = 4 integers.

    Also, you may want to use the name attribute rather than passing the 0 to the document.links[] string.

    good luck
    "It's very important not to embellish on your order. No extraneous comments. No questions. No compliments."
    - Jerry, in "The Soup Nazi"

  7. #6
    Junior Member
    Join Date
    Oct 2003
    Location
    Holland
    Posts
    11
    Member #
    3602
    hi all,

    just have a quick question for you. I wanna use the random links script aswell but the image i want to change after reload is in a table....how will i go about this? Do i just put the code in the table?

    A link to an example would help aswell

    Martijn
    regards,

    Martijn

  8. #7
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    Martijn put this part

    Code:
    <div align="center" style="padidng: 40px 10px 0px 10px;">
    <a href="java script:;" > <img src="one.jpg" name="myPic" alt="A Pic"></a>
    </div>
    in your table...

    any1 know why this kinda flashes through the images before displaying them? some1 told me i should use server side random images.. any ideas ?
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  9. #8
    Junior Member
    Join Date
    Oct 2003
    Location
    Holland
    Posts
    11
    Member #
    3602
    thanks a bunch kirman!
    regards,

    Martijn

  10. #9
    Senior Member kirman's Avatar
    Join Date
    May 2003
    Location
    UK England
    Posts
    765
    Member #
    1499
    Liked
    2 times
    no problem
    Dream like you'll live forever. Live like you're gonna die 2morrow!

  11. #10
    Junior Member
    Join Date
    Nov 2003
    Posts
    1
    Member #
    3827
    is there a way I can make the javascript open the links in a different target such as target="_parent"?

    for example, i use the script on my site http://www.sheaallen.com for the random image on the left side of every page, but i made it an iframe with randomart.php so i don't have to update every page whenever i add new art. Except when you click on the image in the iframe, it just changes that little box frame to the page, instead of changing the entire page...any ideas? or maybe is there a simple script that makes every link open in target="_parent" ?


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:56 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com