name


The attribute name will represents the name of the control, in JavaScript we can find the control by it's name also.

Syntax:

<input type="text" name="textboxname" />

Example:

<html> <head> <title>HTML Tutorial</title> <script language="javascript"> function ShowInput() { var input = document.getElementsByName("txtinput"); if (input.length > 0) alert(input[0].value); } </script> </head> <body> Enter input : <input type="text" name="txtinput" /> <input type="button" name="btnShow" onclick="ShowInput();" value="Show entered input" /> </body> </html>

Output:

HTML Tutorial Enter input :