

Programs in JavaScript
1. Program to get value from the text box.
<html>
<head>
<title>Accessing element by Id</title>
<script>
function disp()
{
var txt = document.getElementById('t1').value
alert(txt);
}
</script>
</head>
<body>
<input type="text" id="t1">
<input type="button" value="Click" onclick="disp()">
</body>
</html>
Output :