Onfocus and onblur event are particularly useful when user type there data in the text box.
Onfoucs: it will perform there action when the user type ther data
Example in the user type there email id in text box help box display Enter your mail id
Onblur:it prerom there action when ther user out of the element
Example:After user type there data when he click the mous other form text box it will fires there event
There important objects are
helpArray=[“ “,” “];
helpText(messageNum);
helpBox
1. <html>
2. <head><title>STUDENTWEBSITE</title>
3. <script type="text/javascript">
4. <!--
5. var helpArray=["Your Name here","Enter you Maild id here","Enter your Address here","studentwebsite.blogspot.com"];
6. function helpText(messageNum)
7. {
8. myForm.helpBox.value=helpArray[messageNum];
9. }
10. //-->
11. </script>
12. <body>
13. <form id="myForm" action="">
14. Name:<input type="text" name="name" value="Name" onfocus="helpText(0)" onblur="helpText(3)" ><br>
15. Email<input type="text" name="email" value="Emaill" onfocus="helpText(1)" onblur="helpText(3)" ><br>
16. Address<input type="text" name="name" value="ADDress" onfocus="helpText(2)" onblur="helpText(3)"><br>
17. help box<textarea name="helpBox" readonly="true">
18. </body>
19. </html>
In the Line:14 when you click mouse on the name text box it will pass the helpText(0)->Your name here
Like that other.
0 Comments