JavaScript Reference/Javascript Methods/getElementById
"getElementById()" Example
<html>
<body>
<script language="JavaScript">
function function1() {
var m = document.getElementById("myA");
alert(m.innerText);
}
</script>
<p>Click in the following element:</p>
<a id="myA"
href="http://www.wbex.ru"
onclick="return(false);"
onmouseup="function1();">Hyper link to wbex.ru
</a>
</body>
</html>
"getElementById()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |document |
+----------------+--------------------------------------------------------------+
"getElementById()" Syntax, Parameters and Note
Note:
Get the element by id.
Syntax:
document.getElementById(param1)
Parameters:
param1 Required; the element"s id value.