XML technologies / CSS / CSS Cookbook / Forms / Using simple HTML text links as submit buttons
(Excerpt from “CSS Kochbuch” by Christopher Schmitt)
Problem
You want to use a simple HTML text link to submit a form.
Solution
Use JavaScript behind the scenes to submit the form:
<form name="msgform" method="get" action="results.php">
<label for="fmmsg">Message</label>
<textarea name="fmmsg" accesskey="m" id="fmmsg" rows="5" cols="14"></textarea>
<a href="javascript:document.msgform.submit( );">Submit</a>
</form>Discussion
Whereas the recipe Submit buttons displayed as simple HTML text explained how to “disguise” a submit button as a simple HTML link, this recipe takes the opposite approach: using a simple text link as a submit button. The main drawback is that it does not work without JavaScript. Browsers that do not support JavaScript, or in which JavaScript is disabled, cannot use forms designed this way.
Copyright of the German edition © 2007 by O’Reilly Verlag GmbH & Co. KG
You may print the online version for your private use.
Otherwise, this chapter from “CSS Kochbuch” is subject to the same conditions as the bound edition: the work, including all its parts, is protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
O’Reilly Verlag GmbH & Co. KG, Balthasarstr. 81, 50670 Köln