Idocs Guide to HTML

Attribute for <BUTTON ...>
NAME = "text string"

NAME sets the name of the button element. If the button is a submit button then the name and the value should be sent to the server. Unfortunately MSIE did not properly implement this feature so NAME is of limited value.

NAME can also be used in scripts. The button can be refered to by using its name as a property of the form. For example, the following code creates a button named go that has blinking text:

<FORM ACTION="../cgi-bin/mycgi.pl" 
   METHOD=POST 
   NAME="myform">
email: <INPUT NAME="email">
<BUTTON NAME="go" TYPE="submit"><STRONG>Go!</STRONG></BUTTON> 
</FORM>

<SCRIPT TYPE="text/javascript">
<!--
function blinker()
{
if (document.forms.myform.go.style.color == 'blue')
   document.forms.myform.go.style.color='red';
else
   document.forms.myform.go.style.color='blue';
setTimeout('blinker()',500);
}

blinker()

//-->
</SCRIPT>

which gives us

email:

Copyright 1997-2002 Idocs Inc. Content in this guide is offered freely to the public under the terms of the Open Content License and the Open Publication License. Contents may be redistributed or republished freely under these terms so long as credit to the original creator and contributors is maintained.