How to make HTML text box read-only effect

php中世界最好的语言
Release: 2018-01-16 09:54:30
Original
2499 people have browsed it

这次给大家带来怎样做出HTML文本框只读效果,做出HTML文本框只读效果的注意事项有哪些,下面就是实战案例,一起来看一下。

<!--方法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">
Copy after login

相信看了这些案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

相关阅读:

H5里图片中有缝隙应该如何解决

HTML5单页面手势滑屏切换如何实现

H5的地理定位怎样使用

The above is the detailed content of How to make HTML text box read-only effect. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!