Add Event Listener To A TextBox

<html>
<head>
<title>Demo</title>
<script type=”text/javascript”>
function textChanged(elm)
{
alert(elm.value);
}

onload = function()
{
var elm = document.getElementById(“mytextbox”);
elm.onchange = new Function(‘textChanged(this)’);
}
</script>
</head>
<body>
<input id=”mytextbox” type=”text”/>
</body>
</html>

Advertisements