HTML中Text設爲不可編輯,不可用

1.readonly = "true"

<input type="text"  readonly = "true"/>

 

2.disabled = "true"

<input type="text"  disabled = "true"/>


3.當focus觸發時,立刻blur,使它無法獲得焦點。

<input type="text" onfocus="this.blur()"  readonly="true"/>


readonly/disabled都可以不跟參數,默認都是不可編輯;disabled="true"文本不可提交,readonly="true"可被提交。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章