View Full Version : Dropdown Help


mynci_tourist
03-30-2005, 10:54 PM
Is it possible to have a code that shows an image based on the dropdown selection, AND have a different caption(words, text) for each pic?

Alcy
03-30-2005, 11:25 PM
Drop Down Menu Message (http://www.hypergurl.com/menumessage.html) + Drop Down Image Selector (http://wsabstract.com/script/cut173.shtml) = <SCRIPT LANGUAGE="JavaScript">

<!-- Drop Down Menu Message Javascript -->
<!-- Original: Stephanie M. Clarkson (thespian@sleepingcat.com) -->
<!-- Web Site: http://www.sleepingcat.com -->
<!-- Distributed by http://www.hypergurl.com -->

<!-- Combo Box Image Selector: -->
<!-- By JavaScript Kit (www.javascriptkit.com) -->
<!-- Over 200+ free JavaScript here! -->

<!-- combined together, weeeeee! -->


<!-- Begin
var messages = new Array(6);
messages[0] = "";
messages[1] = "Have you ever seen anything like this before? <img src='topbanner.gif'>";
messages[2] = "Can you imagine how you could use it on your site?";
messages[3] = "It's great for sharing lots of information.";
messages[4] = "And doesn't take up much space!";
messages[5] = "So, get the code and put it on your site!";
function messageReveal() {
var messageindex = document.mygallery.messagePick.selectedIndex
document.mygallery.messageField.value = messages[messageindex];
}

function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.messagePick.options[document.mygallery.messagePick.selectedIndex].value
}
// End -->
</SCRIPT>

<form name="mygallery">
<select name="messagePick" OnChange="messageReveal();showimage()">
<option value="0">Oooh... a dropdown.
<option value="topbanner.gif">First selection
</select>
<br><p>
<textarea name="messageField"></textarea>
<p align="center"><img src="me.gif" name="pictures" width="99"
height="100">
</form>

Beware the odd spaces the forum is inserting o.O

mynci_tourist
03-30-2005, 11:37 PM
Omg! Thank You! Although the images and text arent showing up :(

Alcy
03-30-2005, 11:45 PM
It's the spaces! They have to go >.<

These lines here:
var messageindex = document.mygallery.messag ePick.selectedIndex

document.mygallery.messag eField.value = messages[messageindex];

document.images.pictures. src=

document.mygallery.messag ePick.options[document.mygallery.messag ePick.selectedIndex].value

mynci_tourist
03-31-2005, 01:31 PM
It's the spaces! They have to go >.<

These lines here:

Oh okay. It works now. Is it possible to put a hyperlink in the text box that the text ussually goes in, or do i need a whold new code for that?

Alcy
04-02-2005, 12:00 AM
I wasn't able to find a script that didn't use a textarea and I don't know enough to write one myself :(

Perhaps the toggle tab menu (http://www.baldean.com/web/devzone.mysp) may be useful?

mynci_tourist
04-02-2005, 12:09 AM
nahhh it would be too big. the thing i am working on is at http://freewebs.com/mynci_tourist453/avatars.htm

Alcy
04-02-2005, 01:42 AM
This is smaller:

Main Page:
http://www.bobbyvandersluis.com/articles/unobtrusiveshowhide.php

Example: http://www.bobbyvandersluis.com/articles/unobtrusiveshowhide/example1a.html

Javascript file:
http://www.bobbyvandersluis.com/articles/unobtrusiveshowhide/showHide_ex1a.js

mynci_tourist
04-02-2005, 04:43 AM
can it be in dropdown menu?