Hello, I am a true beginner and have no clue what I am doing. With that said, I really only want to know one thing...how do I create and insert an area on the main page of my website that displays a different photo each time the website is visited/each time the refresh button is pushed? Please let me know. Thank you.
Create area on web page that displays different photo each time website visited
Collapse
X
-
There can be many solutions. But I'll tell you one of them.Originally posted by timothydHello, I am a true beginner and have no clue what I am doing. With that said, I really only want to know one thing...how do I create and insert an area on the main page of my website that displays a different photo each time the website is visited/each time the refresh button is pushed? Please let me know. Thank you.- Save all the pictures (you need to display once at a time) in a folder (say banners).
- Save them all as 0.png, 1.png, 2.png.... and so on. (keep only one extension thing, jpg or gif or png.)
- Amend the HTML like this.. [html]<body onload="documen t.getElementByI d('banner').src = '/banners/' + Math.round(Math .random()*99) + '.png'">
<img id="banner" src=""></img>
[/html]
PS: 99 is used if you have 100 images... multiply with one less than the actual number of images. -
Comment
-
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).
This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.
MODERATORComment
-
You have been given a good duty!!!! ....Originally posted by acoderPlease remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).
This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.
MODERATOR
:p .. just a joke. I saw you many times adding [code] tags and deleting non-English stuff from other's posts.Comment
-
Yes, moderation 'duties' - someone's gotta do it! Hmm, non-English stuff... I wonder who's been guilty of that.Originally posted by hsriatYou have been given a good duty!!!! ....
:p .. just a joke. I saw you many times adding [code] tags and deleting non-English stuff from other's posts.Comment
-
That didn't work. You just mean save the banners folder to my computer?
I have never used html before. I created my website with the simple iweb program that comes on macs. There is an option to insert an html snippet, and a box appears where the inserted html will show up, I dragged this box to the size of the pictures that I wanted, and inserted the html code (both 1 & 2) that you told me. But my website just has a blue box and a question mark.Comment
-
Originally posted by timothydThat didn't work. You just mean save the banners folder to my computer?
I have never used html before. I created my website with the simple iweb program that comes on macs. There is an option to insert an html snippet, and a box appears where the inserted html will show up, I dragged this box to the size of the pictures that I wanted, and inserted the html code (both 1 & 2) that you told me. But my website just has a blue box and a question mark.
Oh! So now I got your point!!
You want to be creative ha?
I don't know about this iweb program, but it may be helpful for you if you learn some basics of HTML. Then use the above code, it will work. HTML ain't difficult!
The banners folder needs to be in the same folder as the HTML file is. And since your HTML is created by iweb, it won't allow you to edit the <body> tag.
PS: I really liked your idea of each-time-new-banner on the website!!
I'm gonna use it on my website!! ThanksComment
Comment