当前第2页 返回上一页
demo.html:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | <!DOCTYPE html>
<html lang= "en" >
<head>
<meta charset= "UTF-8" >
<title>Document</title>
<style>
form {
width: 100%;
max-width: 640px;
min-width: 320px;
margin: 0 auto;
font-family: "Microsoft Yahei" ;
font-size: 20px;
}
input {
display: block;
width: 100%;
height: 30px;
margin: 10px 0;
}
</style>
</head>
<body>
<form action= "" >
<fieldset>
<legend>表单事件</legend>
<label>
用户名:<input type= "text" name= "userName" id= "userName" >
</label>
<label>
密码:<input type= "text" name= "pwd" id= "pwd" >
</label>
<label>
邮箱:<input type= "email" name= "email" id= "email" >
</label>
<input type= "submit" >
</fieldset>
</form>
</body>
<script>
var txt1 = document.getElementById( "userName" );
var txt2 = document.getElementById( "pwd" );
var txt3 = document.getElementById( "email" );
var num = 0;
txt1.oninput = function () {
num++;
txt2.value = num;
};
txt3.oninvalid = function () {
this.setCustomValidity( "自定义的提示文本" );
};
</script>
</html>
|
以上就是详解HTML5 表单属性的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
HTML5中新事件的详细介绍
HTML5中audio与video标签的使用
用h5实现手机摇一摇的实例详解
为什么现在HTML5的优势越来越大
bootstrap表单怎么提交信息
浅谈h5增强了哪些页面元素
HTML5让图片转圈的动画效果的实现方法介绍
HTML5 video视频字幕的使用和制作方法
HTML5中重新加载音频/视频元素的方法load()
详细介绍HTML5简易在线画图工具的实现案例
更多相关阅读请进入《HTML5》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 详解HTML5 表单属性