<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>control属性与placeholder属性的应用</title>
</head>
<body>
<script>
function setValue(){
var label=document.getElementById("label");
var textbox=label.control;
textbox.value="010010";
}
</script>
<form>
<label id="label">
邮编:
<input id="txt_zip" maxlength="6">
<small>请输入六位数字</small>
</label>
<input type="button" value="设置默认值" οnclick="setValue()">
<p>
<input type="text" placeholder="请输入用户名">
</p>
</form>
</body>
</html>
control属性与placeholder属性
最新推荐文章于 2023-07-27 16:43:04 发布