日期:2014-05-16 浏览次数:20432 次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title> </title> <!--设置文本框的边框颜色和样式--> <style type="text/css"> .input{ border-color:#FF0000; border-style:solid; } </style> <script type="text/javascript" language="javascript" > <!--当文本框为空时,加载css的方法--> function fun(test){ var value= document.getElementById(test).value; var object= document.getElementById(test); if(value==null||value==''){ object.setAttribute("className","input"); }else{ object.setAttribute("className",""); } } </script> </head> <body> <input type="text" onBlur="fun('user_name')" id="user_name" > </body> </html>
?