...

View Full Version : input type problem



progressweb
06-10-2003, 06:38 PM
I am trying to use the following code and substitue a button type for an image instead. As soon as I do it, the dropdown no longer take you to the right link:

here is the code after I change the type from button to image:
<form="a294">
<select name="a969" size="1" style="background-color:#FFFFD7">
<option value="index.html">Home</option>
<option value="bw.html">BestWestern.com</option>
<option value="javascript:void(window.open(&quot;htttp://test.html&quot;,&quot;_blank&quot;,&quot;scrollbars&quot;,&quot;width=800,height=400&quot;))">Rates
and Reservations</option>
<option value="gc.html">Frequent Traveler</option>
<option value="pets.html">Pets</option>
<option value="vtour.html">Virtual Tour</option>
<option value="local.html">Get Local</option>
</select>
<input type='image' src='pics/buttonNextGrey.gif' alt='' width='17' height='17' border='0' onClick="location=document.a294.a969.options[document.a294.a969.selectedIndex].value">
</form>

Vladdy
06-10-2003, 07:34 PM
Per HTML 4.01 input type image creates a graphical submit button (http://www.w3.org/TR/html4/interact/forms.html#input-control-types) so while the first thing that happens is the change of window.location by your script the followed form submission relaods your current page (since action is not specified).
Use:
<button type="button"><img ....></button> instead.
FYI: another possible hack would be:
<form ... onsubmit="return false"> but it would not make much sense in your case.

progressweb
06-10-2003, 08:14 PM
It worked but now a border that "pushes" down when I click on it appears around the image. Any way to get rid of it? Here is the code now:

<button type="button" onClick="location=document.a294.a969.options[document.a294.a969.selectedIndex].value"><img src="pics/buttonNextGrey.gif" width="17" height="17" border="0"></button>

Vladdy
06-10-2003, 08:17 PM
<button style="border-width:0px">

progressweb
06-10-2003, 08:22 PM
Thanks, worked like a charm!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum