JavaScript DHTML/Event onMethod/onFocus — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 07:20, 26 мая 2010
"onFocus" Example
<head>
<script language="JavaScript">
function function1() {
document.getElementById("myL").blur();
alert("<A> element has received focus.");
window.open("http://www.wbex.ru", "", "");
}
</script>
</head>
<body>
<a id="myL"
href="http://www.wbex.ru/"
target=_blank
onFocus="function1()">
wbex.ru
</a>
</body>
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>