<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title> shutdown layer Practice </title> <style type=" Text/css "> #divUserName {width:200p X height:30px; BORDER:1PX solid black; Background: #cccccc; font-size:12px; margin-top:10px; } </style> <script language= "javascript" type= "Text/javascript" > window.onload = function () {D Ocument.getelementbyid ("Tbxusername"). focus (); document.getElementById ("Tbxusername"). onblur = function () {document.getElementById ("Divusername"). Style.disp Lay = ' none '; } document.getElementById ("Tbxusername"). onfocus = function () {document.getElementById ("Divusername" ). style.display = '; }} </SCRIPT> </pead> <body> <input type= "text" id= "Tbxusername"/><div id= "Divusername" > This is a layer </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]