The onfocus Event Handler
<html>
<head>
<title>Elements Array</title>
<script type="text/javascript">
function prompt(msg) {
window.status = "Please enter your " + msg + ".";
}
</script>
</head>
<body>
<form>
Enter your first name:<input type="text" name="firstName"
onfocus="prompt('first name')" />
<p>Enter your last name:<input type="text" name="lastName"
onfocus="prompt('last name')" /></p>
<p>Enter your address:<input type="text" name="address"
onfocus="prompt('address')" /></p>
<p>Enter your city:<input type="text" name="city"
onfocus="prompt('city')" /></p>
</form>
</body>
</html>
Related examples in the same category