方法一: <input id= "File1" type= "text" disabled/> 不可用
方法二: <input id= "File1" type= "text" readonly/> 只读
方法三: <input id= "File1" type= "text" style="display:none"/> 隐藏(但占位置)
方法四: <input id= "File1" type= "text" style="visibility:hidden"/> 隐藏(不占位置)
有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如使<input type="text" name="input1" value="中国"> 的内容,"中国"两个字不可以修改。实现的方式归纳一下,有如下几种。
方法1: onfocus=this.blur()
复制代码代码如下:
<input type="text" name="input1" value="中国" onfocus=this.blur()>
方法2:readonly
复制代码代码如下:
<input type="text" name="input1" value="中国" readonly>
<input type="text" name="input1" value="中国" readonly="true">
方法3: disabled
复制代码代码如下:
<input type="text" name="input1" value="中国" disabled>
方法二: <input id= "File1" type= "text" readonly/> 只读
方法三: <input id= "File1" type= "text" style="display:none"/> 隐藏(但占位置)
方法四: <input id= "File1" type= "text" style="visibility:hidden"/> 隐藏(不占位置)
有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,如使<input type="text" name="input1" value="中国"> 的内容,"中国"两个字不可以修改。实现的方式归纳一下,有如下几种。
方法1: onfocus=this.blur()
复制代码代码如下:
<input type="text" name="input1" value="中国" onfocus=this.blur()>
方法2:readonly
复制代码代码如下:
<input type="text" name="input1" value="中国" readonly>
<input type="text" name="input1" value="中国" readonly="true">
方法3: disabled
复制代码代码如下:
<input type="text" name="input1" value="中国" disabled>
标签:
html,文本框,只读
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com
暂无“html 文本框(text)不可用只读的多种实现方法”评论...
更新日志
2024年05月20日
2024年05月20日
- 张琍敏1978-雪中莲[台湾复刻版][WAV+CUE]
- 叶蕴仪1993-睡美人[日本版][WAV+CUE]
- 夜晚助兴音乐-群星《新时代床头音乐-性能量》2CD[WAV]
- 24K德国HD金碟《历届奥斯卡获奖金曲》3CD[WAV整轨]
- 邰正宵《重燃爱恋 贰 Walk On》[FLAC/分轨][431.72MB]
- 苏文劭《雨停出来走走》[320K/MP3][81.11MB]
- 苏文劭《雨停出来走走》[FLAC/分轨][210.76MB]
- 群星《2024好听新歌04》十倍音质WAV分轨
- 陈宁《弹指之间HQ》头版限量[低速原抓WAV+CUE]
- 陈宁《故人还》HQCDII限量签名版[低速原抓WAV+CUE]
- 苏文劭《春曲(Lessons)》[320K/MP3][39.8MB]
- 苏文劭《春曲(Lessons)》[FLAC/分轨][97.78MB]
- 群星《2006香港高级视听展原音精选 SACD》[ISO][2G]
- 张琍敏1977-枫林小雨[台湾复刻版][WAV+CUE]
- 林一峰2014-COOKINGMUSIC[香港首版][WAV+CUE]