JavaScript DHTML/Event onMethod/onFocus

Материал из Web эксперт
Перейти к: навигация, поиск

"onFocus" Example

   <source lang="html4strict">

   

<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>


 </source>
   
  


The onfocus Event Handler

   <source lang="html4strict">
  

<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")" />

Enter your last name:<input type="text" name="lastName" onfocus="prompt("last name")" />

Enter your address:<input type="text" name="address" onfocus="prompt("address")" />

Enter your city:<input type="text" name="city" onfocus="prompt("city")" />

</form> </body> </html>


 </source>