Tuesday, 24 April 2012

Accessing text box though JavaScript

<script type="text\JavaScript">
function a()
{
 var b=document.getElementById("t1").value;
alert(b)
}
 </script>
<input type='text' id='t1' />
<input type='button' onclick='a()' />


the text box has id t1, which can be used to access its content through DOM method
such as document.getElementById("t1").value



No comments:

Post a Comment