Get element from a document by id : getElementById « DOM Node « JavaScript Tutorial






<html>
<head>
<title>New Page 1</title>
<script language="JavaScript" type = "text/javascript">
<!--
function Test()
{
    alert(document.getElementById("testinput").value);
}
//..>
-->
</script>
</head>
<body>
<form name="textfield">
   <input type="text" name="T1" size="20" id="testinput">
   <input type="button" value="Click Here" name="B1" onClick="Test()"></p>
</form>
</body>
</html>








23.9.getElementById
23.9.1.Get element from a document by id