Button.type

JavaScript 1.1+, JScript 1.0+ Nav3+, IE 3+, Opera3+ Syntax

document.form.
							button.type

Description

The type property provides access to the TYPE attribute of the button. This property is a read-only string that always contains button.

Example

Listing 7.33 creates buttons that relate to various math problems. The type property is used to determine the number of buttons on the page. This number is then used in the instructions displayed on the bottom of the page.

Listing 7.33 Accessing a Button's type Property
 <html> <h2>The Math Page</h2> <form name="mathForm"> <input type="button" name="4plus2" value="(4 + 2)" onClick="document.mathForm.answer.value='(4 + 2) = 6'"> <input type="button" name="4minus2" value="(4 - 2)" onClick="document.mathForm.answer.value='(4 ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.