Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation input type problem

    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>

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Per HTML 4.01 input type image creates a graphical submit button (http://www.w3.org/TR/html4/interact/...-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.
    Last edited by Vladdy; 06-10-2003 at 08:36 PM.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #3
    New Coder
    Join Date
    Aug 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    That worked but...

    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>

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <button style="border-width:0px">
    Last edited by Vladdy; 06-10-2003 at 09:19 PM.
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    New Coder
    Join Date
    Aug 2002
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Awesome!

    Thanks, worked like a charm!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •