Jan 17, 2010

getElementById in JavaScript

I have an example explained here to show how "getElementById" is used in JavaScript. Write me (saalram.service@gmail.com) if you find difficult here.

File :  GetElement_JS.html

<html>
<head>
<script type="text/javascript">
function alertId()
{
var txt="Id: " + document.getElementById("myButton").id;
txt=txt + ", type: " + document.getElementById("myButton").type;
txt=txt + ", value: " + document.getElementById("myButton").value;
alert(txt);
document.getElementById("myButton").disabled=true;
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" id="myButton" onclick="alertId()" />
</form>
</body>
</html>

====================
Publicize yourself ... Free!
saalram
====================

No comments:

Post a Comment

Saalram.com

Saalram
Publicize yourself ...
http://saalram.com

Free !!!


Place your Ad here - Free!!!
just drop us a mail ... saalram.service@gmail.com

Free !!!