日期:2014-05-16 浏览次数:20396 次
<html> <head> <title>Test</title> <meta http-equiv="content-Type" content="text/html;charset=gb2312" /> <script type="text/javascript"> </script> </head> <body> <input id="test11" type="text" style="margin-left: 100px; float: left; margin-top: 100px" id="key" name="key" value="请输入关键字" onfocus="if(value==defaultValue){value='请输入关键字';this.style.color='#999999'}" onblur="if(!value){value=defaultValue;this.style.color='#999999'}" onclick="this.value=''" /> </body> </html>
------解决方案--------------------
样式自己调整一下,功能可以实现
<HTML> <HEAD> <TITLE><%=homepage_title%>--管理中心-用户登陆</TITLE> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="JavaScript"> <!-- function window_onload() { document.mail.username.focus(); } function cancel() { mail.reset(); document.getElementById("txtHint").innerHTML=""; } function IsValid() { if (document.mail.username.value=="") { document.getElementById("txtHint").innerHTML="用户名不能为空"; document.mail.username.focus(); return false; } if (document.mail.password.value=="") { document.getElementById("txtHint").innerHTML="密码不能为空"; document.mail.password.focus(); return false; } } //--> </script> <style type="text/css"> <!-- .STYLE1 {font-size: 12px} --> </style> </HEAD> <BODY topMargin=0 leftmargin="0" onLoad="return window_onload()"> <p> </p> <form name=mail action="ckecklogin.asp" onSubmit="return IsValid();" method=post> <table width=234 border=1 align="center" cellpadding=0 cellspacing=0 bgcolor="#5BD2E8"> <tbody> <tr> <td height="37" colspan="2" align="center" style="line-height:180%" ><span id="txtHint" class="STYLE1"></span></td> </tr> <tr> <td width="66" height="28" style="line-height:180%"> <span class="STYLE1">帐 号:</span> </td> <td width="162" style="line-height:180%"><input type="text" name="username" size="20" class="button1"></td> </tr> <tr> <td height="28" class="STYLE1" style="line-height:180%"> 密 码: </td> <td height="28" style="line-height:180%"><input type="password" name="password" size="20" class="button1"></td> </tr> <tr> <td height="28" colspan="2" align="center" style="line-height:180%"> <input type="submit" name="Submit" value="提交" id="Submit"> <label for="label"></label> <input type="button" name="Submit2" value="重置" id="label" onClick=" c