<!--方法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="true">
相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
相关阅读:
以上就是怎样做出HTML文本框只读效果的详细内容,更多请关注php中文网其它相关文章!
![php中文网最新课程二维码](/static/images/article_wechat2021.jpg?1111)
声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论