<strong>一、需求原因<br></strong>填寫表單時需要達到下列效果<br><img alt="" src="http://files.jb51.net/file_images/article/201401/20140126095840.png"><br><strong>二、具體實現<br></strong><div class="codetitle"> <span><a style="CURSOR: pointer" data="14976" class="copybut" id="copybut14976" onclick="doCopy('code14976')"><u>複製代碼</u></a></span> 代碼如下:</div> <div class="codebody" id="code14976"> <br><br><br><br><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <br><title>滑鼠點擊後無文字,挪開滑鼠後有文字</title> <br><script language="JavaScript" src="../jQuery/jquery-1.7%20.1.min.js"></script><br><script type="text/javascript"><BR> $(function(){<BR> "#account").focus(function(){<BR> varoldValue = $(this).val();<BR> == $(this).val(" ");<BR> }<BR> }); <BR> ).blur(function(){<BR> alert("12") ;<BR> varoldValue = $(this).val();<BR> $(this).val(this.defaultValue);<BR> }<BR> } }<BR> );<BR> });<BR></script><br><br><br>帳號:<input id="account" name="account" type="text" value="請輸入帳號"><br><br><br><br> </div>