JavaScript Tutorial/Form/Focus
Версия от 18:52, 25 мая 2010; (обсуждение)
Set Form focus
<html>
<head>
<title>Set Form focus</title>
<script type="text/javascript" language="javascript">
<!-- //
function SetFocus(){
document.SimpleForm.FirstInput.focus();
}
function FindMaxAndMin(){
SetFocus();
}
// -->
</script>
</head>
<body onload="SetFocus()">
<form name="SimpleForm">
<table>
<tr>
<td width="25%" align="right">Enter first number:</td>
<td><input name="FirstInput" type="text"></td>
</tr>
<tr>
<td width="25%" align="right">Enter second number:</td>
<td><input name="SecondInput" type="text"></td>
</tr>
<tr>
<td width="25%" align="right">Enter third number:</td>
<td><input name="ThirdInput" type="text"></td>
</tr>
<tr>
<td width="25%" align="right"> </td>
<td><button type="Button" onclick="FindMaxAndMin()">
Click to calculate</button></td>
</tr>
</table>
</form>
</body>
</html>