Results 1 to 7 of 7

Thread: random image every time refresh

  1. #1
    Join Date
    Aug 2006
    Posts
    235
    Thanks
    30
    Thanked 2 Times in 2 Posts

    Exclamation random image every time refresh

    i need a very simple code to make it so my affilates button shuffle through every time you refresh or go to another part of the site.


    here is my site. modernrevolutions.net and where it says affiliates i want it to have 1 button and then refresh and then pick another one at random. however i still have to be able to make the pics links to the site of course and i want it so when the pic changes the URL to the site stays with the image lol. it would be wonderful if someone gave me the code thanks

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I am too lazy to code it for you so have a look at this:

    http://www.javascriptkit.com/script/cut144.shtml
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  3. The Following User Says Thank You to Jas For This Useful Post:

    ModernRevolutions (06-30-2008)

  4. #3
    Join Date
    Aug 2006
    Posts
    235
    Thanks
    30
    Thanked 2 Times in 2 Posts

    Default

    THANKS SO MUCH!!!! it works WONDERFULLY!!!!!!!!

  5. #4
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Your welcome. Glad it works
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  6. #5
    Join Date
    Aug 2006
    Posts
    235
    Thanks
    30
    Thanked 2 Times in 2 Posts

    Default

    ok im using the code and it working perfectly, however i want to make it so when someone clicks on the affiliate button it opens in a new window/tab. and i try adding target="new" at after the URL and it didnt work. the image just disappeared

  7. #6
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You need to make some changes in the below mentioned code. Highlighted the changes you need to make.
    Code:
    document.write('<a href='+'"'+imagelinks[ry]+'"'+' ><img src="'+myimages[ry]+'" border=0 id="image"></a>')
    Insert the following code in to the script element of your page.
    Code:
    function openWin(){
    	var w = window.open("","","height=400,width=500");
    	w.document.write ("<html>\n<head>\n<title>Popup Document</title>\n</head>\n<body>\n");
    	w.document.write ("<img src='" + document.getElementById('image').src + "' border='0'>");
    	w.document.write ("\n</body\n</html>");	
    	w.document.close();
    }
    After that in onclick event of the button you've mentioned invoke openWin function. You'll be able to open a new window and the image will be in it.

    Hope this helps.

  8. #7
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    One way to code it yourself and not STEAL would be to use the Math.random() function along with the Math.round() function. Note that this is JavaScript.

    -maigcyte

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
  •