大家好,又见面了,我是你们的朋友全栈君。
<table align="center" width="337" height="204" border="0"> <tr> <td width="108">用户名:</td> <td width="213"><form name="form1" method="post" action=""> <input type="text" name="textfield" οnfοcus="txtfocus()" onBlur="txtblur()"> </form></td> </tr> <tr> <td>密码:</td> <td><form name="form2" method="post" action=""> <input type="text" name="textfield2" οnfοcus="txtfocus()" onBlur="txtblur()"> </form></td> </tr> <tr> <td>真实姓名:</td> <td><form name="form3" method="post" action=""> <input type="text" name="textfield3" οnfοcus="txtfocus()" onBlur="txtblur()"> </form></td> </tr> <tr> <td>性别:</td> <td><form name="form4" method="post" action=""> <input type="text" name="textfield5" οnfοcus="txtfocus()" onBlur="txtblur()"> </form></td> </tr> <tr> <td>邮箱:</td> <td><form name="form5" method="post" action=""> <input type="text" name="textfield4" οnfοcus="txtfocus()" onBlur="txtblur()"> </form></td> </tr> </table> <script language="javascript"> <!-- function txtfocus(event){ //当前元素获得焦点 var e=window.event; var obj=e.srcElement; //用于获取当前对象的名称 obj.style.background="#FFFF66"; } function txtblur(event){ //当前元素失去焦点 var e=window.event; var obj=e.srcElement; obj.style.background="FFFFFF"; } //--> </script>

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/148387.html原文链接:https://javaforall.net