html5中改变label值
我要button按钮按下时,把输入文本框里的值设置为110000,代码如下,怎么不行呢?<!DOCTYPEhtml><html><headlang="en"><metac...
我要button按钮按下时,把输入文本框里的值设置为110000,代码如下,怎么不行呢?
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>H5 control</title>
</head>
<body>
<script>
function setValue(){
var mylabel = document.getElementById("label");
var textbox = mylabel.control;
textbox.value = "110000";
}
</script>
<form>
<label id="=label">
邮编:
<input id="txt_zip" maxlength="6">
</label>
<input type="button" value="设置默认值" onclick="setValue()">
</form>
</body>
</html> 展开
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>H5 control</title>
</head>
<body>
<script>
function setValue(){
var mylabel = document.getElementById("label");
var textbox = mylabel.control;
textbox.value = "110000";
}
</script>
<form>
<label id="=label">
邮编:
<input id="txt_zip" maxlength="6">
</label>
<input type="button" value="设置默认值" onclick="setValue()">
</form>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询