一、input輸入框有文字提示,點擊消失
1、js解決辦法
onfocus事件檢查當前值,如果是默認值,就將value屬性置空.如:
<input type="text" value="請輸入編碼" οnfοcus="javascript:if(this.value=='請輸入編碼')this.value='';">
<input type="text" value="請輸入編碼" οnfοcus="this.value=''" οnblur="if(this.value==''){this.value='請輸入編碼'}" />
2、HTML5的placeholder屬性
<input type="text" placeholder="請輸入編碼" />
二、js給td賦值
1、在td 中放一個 <input type ='text' id ='name'></input>
document.getElementById("name").innerText="要賦的值";
2、在td中放個標籤<td><div id="aa"></div></td>
document.getElementById('aa').innerHTML="要賦的值";