Working with Generic Buttons


Generic buttons (see Figure 68.1) are clickable, but they don't do anything when the visitor clicks them, unlike submit and reset buttons. You must specifically program these buttons to do what you want them to do, which is usually to launch a JavaScript function. The button's input tag takes the onClick event, where you put the name of the function that you want to launch.

Listing 68.1. View Source for Figure 68.1.
 <form>   <input type="button" name="totalButton"  value="Calculate Total" onClick="doTotal();"> </form> 

Figure 68.1. A generic button is clickable, but it doesn't do anything until you add an onClick event to its tag.


The name attribute of the button's input tag identifies the button, and the value attribute contains the label that appears on the button's face. The value of the onClick event is the name of the JavaScript function that launches when the visitor clicks the button.



Web Design Garage
Web Design Garage
ISBN: 0131481991
EAN: 2147483647
Year: 2006
Pages: 202
Authors: Marc Campbell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net