Click to See Complete Forum and Search --> : Choose image to display


ro217
09-13-2003, 03:39 PM
Could anyone write a piece of code for me that would have a pull-down menu to choose a certain image and then have the image displayed upon selection? i.e. I'd like for the site to be customized with a certain image that the user can select using the menu. Perhaps there's an easier way to do this? And is it possible to keep this setting using a cookie? i don't know much about javascript, so please explain things to me simply ;) . Thank you a lot, and if you have any question regarding my request, just ask.

ro217
09-13-2003, 03:57 PM
if you'd like an example of the effect i'm going for, visit Apple's iPod site (http://www.apple.com/ipod) On the top right corner you can select a color for the main center image to be, and then the image changes. I'd like something to that effect if it's possible in plain javascript without stylesheets (like apple uses for that site). If it's just not do-able, let me know, and i'll move on... =)

David Harrison
09-13-2003, 06:18 PM
Yes it is possible, but you would still have to include an alternative, non-changable image, for those without JavaScript inside some noscript tags. I could probably whip something up if you give me enough time.

ro217
09-13-2003, 07:29 PM
that would be absolutely perfect. i'd appreciate it a lot if you could do put together something. i'm in no rush to finish things up. Thank you again, so much.

David Harrison
09-14-2003, 07:26 AM
OK, here it is. There are two pages so that you can see that the image stays from page to page. Even when the page is closed and opened again, the image is the one that you had on when you left, because it expires 6 months after it was created.
I have removed the two cookie functions from the source of the two pages and put it in a separate .js file to save space if you are going to use this script on many pages.

Anyway, enough of this, see what you think:

ro217
09-14-2003, 03:57 PM
hey thanks, man, it works perfectly just the way i wanted it. (one of these days i've got to learn javascript ;) ). if you'd like to see how it's working: http://mysite.verizon.net/res07oax/Untitled-2.html or /Untitled-3.html . I'm working on the template that'll update all of the pages, so it should be all up soon. Thanks a million.

~Robin

David Harrison
09-14-2003, 04:15 PM
If you are only going to change that top bar, you could just change the background colour, and have the "The Power Book Chronicles" image as a .gif with transparent parts in it to let the colour show through.

I also notice that when the image changes, the alt text for the image stays the same, "gray". If you want to change the alt text when the image changes, check out this thread (http://forums.webdeveloper.com/showthread.php?s=&threadid=17467).

Happy to help. :)