View Full Version : Drop Down Image Selector I

11-08-2004, 09:38 PM
Halo Amigos!

I succesfully executed the Drop Down Image Selector I script into my page. I have the images appearing as I want them. However, I also have three other options in my drop down menu that do not require images at all. When i give it a different value other than a path to an image, it displays a broken image placeholder on the page.

How do I bypass this without changin the value that I need?


Adios Amigos!

ps: [URL=http://www.hcedesigns.com/spec.html]

Mr J
11-08-2004, 10:12 PM
Please try the following

<TITLE>Document Title</TITLE>

<SCRIPT language=javascript>

function showimage(){
if (!document.images)


if(data.indexOf("gif")!= -1||data.indexOf("jpg")!= -1){ // if an image
document.getElementById("display").innerHTML='<IMG height=72 src="'+data+'" width=72 name=pictures>' // show the image
else{ // if not an image
document.getElementById("display").innerHTML=data // then write the string


<FORM name="specForm">
<SELECT class=txtFields onchange=showimage() name=poolshape>
<OPTION value=null selected>--</OPTION>
<OPTION value="Leave it to our designers">Leave it to our designers!</OPTION>
<OPTION value="Drawn on attached 8.5x11">Drawn on attached 8.5x11</OPTION>
<OPTION value=Lap>Lap</OPTION>
<OPTION value=pic1.jpg>Pic1</OPTION>
<OPTION value=?>?</OPTION>
<OPTION value=?>?</OPTION>

<div id="display"></div>


11-08-2004, 10:17 PM
But it doesnt work... actually, the code is in line, but throws up an error when you go and select pic1.

Currently, all selections show the same image. Am i missing something that needs to be changed?

Thanks for the speedy reply "silent one"



Mr J
11-09-2004, 12:00 AM
Did you try the code before putting it in your page?

I forgot to tell you to change this line in your page

<IMG height=72 src="Pool Designs,Swimming Pool Plans, Aquatic Engineering, Residential &amp; Commercial Pool-Spa Designs by Horner Consulting engineers!_files/gr004side.gif" width=72 name=pictures>

for this line

<div id="display"></div>

11-09-2004, 02:03 PM
Hi Mr.J,

I cannot find that string of code anywhere in my page...

11-09-2004, 02:40 PM
Dude, my apologies, after re-reading your instructions, i got it to work.

Thank you very much.