Warning: Undefined array key "night" in /www/wwwroot/dhaomu.com/wp-content/themes/b2/header.php on line 18

HTML中让表单input等文本框为只读不可编辑的方法

有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,

如使input text的内容,中国两个字不可以修改有时候,我们希望表单中的文本框是只读的,让用户不能修改其中的信息,

如使<input type="text" name="input1" value="中国"> 的内容,"中国"两个字不可以修改。实现的方式归纳一下,有如下几种。 

方法1: οnfοcus=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="true">

完整的例子:


<input name="ly_qq" type="text" tabindex="2" onMouseOver="this.className='input_1'" onMouseOut="this.className='input_2'" value="123456789" disabled="true" readOnly="true" />

温馨提示:
1.本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:duhaomu@163.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有资源仅限于参考和学习,版权归原作者所有,更多请阅读网站声明

给TA赞赏
共{{data.count}}人
人已赞赏
未整理

室内手绘入门教程视频课程

2021-3-25 0:00:00

未整理

私域流量如何引流?私域流量实战营,7 天收获属于您的私域流量池

2021-3-27 0:00:00

0 条回复 A文章作者 M管理员

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914

Warning: Trying to access array offset on value of type null in /www/wwwroot/dhaomu.com/wp-content/themes/b2/functions.php on line 3914
----《》
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索