[thelist] input type="image" vs. input type="button"
Tab Alleman
talleman at Lumpsum.com
Mon Aug 21 16:09:45 CDT 2006
I think the input type="image" doesn't support an onClick handler. Instead you'll want to use your form's onSubmit handler.
> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of
> jono at charlestonwebsolutions.com
> Sent: Monday, August 21, 2006 4:59 PM
> To: thelist at lists.evolt.org
> Subject: [thelist] input type="image" vs. input type="button"
>
>
> I would like to use a custom image for the button on the example form
> below. Using an image for the button breaks the form's
> functionality, but
> I am not sure why?
>
> This does not work:
>
> <div id="form-wrap">
> <form name="example">
> <label for="topics">Select a topic:</label>
> <select name="topics">
> <option value="selected">Tell me more about...</option>
> <option value="http://www.page1.php">Page One</option>
> <option value="http://www.page2.php">Page Two</option>
> <option value="http://www.page3.php">Page Three</option>
> <option value="http://www.page4.php">Page Four</option>
> </select>
> <input type="image" src="button.gif"
> onClick="location=document.example.topics.options[document.exa
> mple.topics.selectedIndex].value;"
> value="GO" />
> </form>
> </div>
>
>
>
> This Does Work:
>
> <div id="form-wrap">
> <form name="example">
> <label for="topics">Select a topic:</label>
> <select name="topics">
> <option value="selected">Tell me more about...</option>
> <option value="http://www.page1.php">Page One</option>
> <option value="http://www.page2.php">Page Two</option>
> <option value="http://www.page3.php">Page Three</option>
> <option value="http://www.page4.php">Page Four</option>
> </select>
> <input type="button"
> onClick="location=document.example.topics.options[document.exa
> mple.topics.selectedIndex].value;"
> value="GO" />
> </form>
> </div>
>
> What is it about custom images for form buttons that break
> the JavaScript
> in the form? Is there an alterantive approach to what I have
> above that
> will work?
>
> Thanks,
>
> Jono
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
More information about the thelist
mailing list