Drop Down Box with Image as button - Drop Down Box with Image as Button

They have: 2 posts

Joined: May 1999

Is there anybody out there who knows how to use a drop down box with an image for a button. When I do it the x and y co-ordinates show up in the URL. How do I overcome this problem! Thanks for the help!

----------
Marc de Jong

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Try it this way and see if it works:

<SCRIPT language="JavaScript">
<!--
function goto()
{
window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value;
}
//-->
</SCRIPT>
<FORM name="guideform">
<SELECT name="guidelinks">
<OPTION SELECTED value="page1.htm">Page 1
<OPTION value="page2.htm">Page 2
</SELECT>
  
<A HREF="javascript:goto()"><IMG SRC="yourimage.gif" border="0"></A>
</FORM>

----------
John Pollock
http://www.pageresource.com

They have: 5,633 posts

Joined: Jan 1970

Hi,

Wouldn't be easier this?

<FORM name="guideform">
<SELECT name="guidelinks">
<OPTION SELECTED value="page1.htm">Page 1
<OPTION value="page2.htm">Page 2
</SELECT>
<INPUT type="image" src="image.gif">
</FORM>

This way you don't have to use JavaScript (statisitcs show that more than 10% of surfers have JS turned off on their browsers Smiling)

Cheers

----------
wdresources
http://www.wdresources.com

They have: 2 posts

Joined: May 1999

I tried the two above examples. The 1st one using the function does not seem to work. I have done exactly what was written. When I click on the image it dosen't go anywhere. I see the logic behind it and don't see why it wouldn't work!

The second example given still gives the x y co-ordinates in the URL.

Any other suggestions?

----------
Marc de Jong

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

Hmm..

It worked for me, if you post your url I can take a look at it and see if I can figure out what is going wrong.

Oh, what browser/os are you using. It may make a difference here. Smiling

----------
John Pollock
http://www.pageresource.com

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.