...

View Full Version : Drop Down Image Selector I



fncuis
11-08-2004, 08: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?

Thanks!

Adios Amigos!

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

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


<HTML>
<HEAD>
<TITLE>Document Title</TITLE>

<SCRIPT language=javascript>
<!--

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

data=document.specForm.poolshape.options[document.specForm.poolshape.selectedIndex].value

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
}

}
//-->
</SCRIPT>


</HEAD>
<BODY>
<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>
</SELECT>
</FORM>

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

</BODY>
</HTML>

fncuis
11-08-2004, 09: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"

-F

http://www.hcedesigns.com/spec.html

Mr J
11-08-2004, 11:00 PM
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>

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

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

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

Thank you very much.

-F



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum