Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

FileUpload onFocus

Syntax onFocus="command" The onFocus event handler notifies you when the focus is set on the upload box. <html>     <head>     <title>Using the onFocus event handler</title>     </head>     <body>     <script language="JavaScript">     <!--     function showMsg1(){         document.form1.msg.value += "Focus on the FileUpload box\n";     }     function showMsg2(){         document.form1.msg.value += "Focus removed from FileUpload box\n";     }     -->     </script>     <form name="form1">     Click in the FileUpload box to set focus to it.     <br><br>     <input type="file" name="uploadbox" onFocus = 'showMsg1()'>     <br><br>     Click on the button to remove focus from the FileUpload box.     <br>     <input type="button" value="Click here" onClick='showMsg2()'>     <br><br>     <textarea name="msg" rows="5" cols="50"></textarea>     </form>     </body>     </html>