【发布时间】:2014-07-27 22:50:01
【问题描述】:
为什么下面的段落不起作用?
<body onload="x()" background=" http://theworldsbestever.s3.amazonaws.com/blog/wp-content/uploads/2013/02/tumblr_inline_mi17k7Afai1qz4rgp.gif"> <font size="32%"><h1 style="font-family: Verdana; color: red; text-align: center"><u>How long is your text?<u></font>
</h1>
<br>
<div style="text-align: center;">
<input style="text-align: center;" id="input1" maxlength="6" placeholder="Enter Some Text">
<br><br>
<button type="button" onclick="x()">Submit</button>
</div>
<p id="textLength2" style="color: white; text-align: center; font-family: verdana;"></p>
<script>
function x() {
var textLength = document.getElementById("input1");
var textLength = textLength.length;
document.getElementById("textLength2").innerHTML = textLength;
}
</script>
</body>
【问题讨论】:
-
什么意思?
-
下面的段落应该是返回输入字段的长度,但它不起作用
-
“你能找到错误”问题are not good questions for Stack Overflow。确保您提供一个简短但对问题的具体说明,准确地告诉我们哪里出了问题。 “它不起作用”不是问题陈述。
标签: javascript html css