Results 1 to 6 of 6

Thread: picture ticker on refresh change pick

  1. #1
    Join Date
    Apr 2007
    Location
    uk
    Posts
    35
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default picture ticker on refresh change pick

    Hi guys and girls its me again...
    I saw on here a while ago now a lady asking about how to put just a picture up and have it change every time the page is refreshed, i looked and thought that would be good for my site, but now i have lost the artical on here, can any one tell me where it is or maybe give me a codeing again for it?
    thanks guys and girls.

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

    Default

    Here is a demo page

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    	<head>
    		<title>Untitled Document</title>
    		<style type="text/css">
    
    		</style>
    		<script type="text/javascript">
    			//You need to specify the path of your images if they are stored in another folder (not with the page). 
    			//You need to store the image extension in the following string.
    			//As its been demonstrated multiple images can be seperated using comma operator
    			var imgs = "img1.gif,img2.gif,img3.gif,img4.gif,img5.gif,img6.gif,img7.gif,img8.gif,img9.gif,img10.gif,img11.gif,img12.gif,img13.gif,img14.gif,img15.gif,img16.gif";
    			imgs = imgs.split(',');
    			window.onload = function(){
    				var rnd = Math.floor(Math.random()*imgs.length); //Generates a random number that comes between 0 and the length of imgs array.
    				document.getElementById('ticker').src = imgs[rnd]; //Changes the image element source based on the random number.
    			};
    		</script>
    	</head>
    	<body>
    		<div>
    			<img id="ticker" src="" border="0" />
    		</div>
    	</body>
    </html>
    Hope this helps.

  3. #3
    Join Date
    Apr 2007
    Location
    uk
    Posts
    35
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    cant seem to get this to work?

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    I'd try putting this in the looking for a code or script forum.

  5. #5
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Quote Originally Posted by forgetmenow View Post
    cant seem to get this to work?
    Ensure to replace highlighted with the images at your end separated by a comma:
    Code:
    var imgs = "img1.gif,img2.gif,img3.gif,img4.gif,img5.gif,img6.gif,img7.gif,img8.gif,img9.gif,img10.gif,img11.gif,img12.gif,img13.gif,img14.gif,img15.gif,img16.gif";
    So if you have three images, namely image1.jpg, image2.gif and image3.png then it shall be like this:
    Code:
    var imgs="image1.jpg,image2.gif,image3.png";
    Hope that makes sense.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  6. #6
    Join Date
    Apr 2007
    Location
    uk
    Posts
    35
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    yes i have done that, THE PICKS SHOW BUT IS THERE ANY WAY TO LINK T=EACH PICK TO GO TO THE PAGE WHERE IT IS ON THE SITE, HERE IS MY TEST PAGE.
    http://www.waggysfancydress.co.uk/test_page.html
    sorry just noticed my capp lock was on, i am not shouting honest lol

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
  •