为什么下面的段落不工作?为什么这不起作用?我做错了什么?
<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>
你是什么意思不起作用? –
下面的段落应该返回输入字段的长度,但它不起作用 – Fizzy
“你能找到bug”的问题[对于Stack Overflow来说不是很好的问题](http://meta.stackoverflow.com/questions/ 253787 /是,有正当-FIX-MY-代码吗?CB = 1#253788)。确保你提供了一个简短的,但**具体的问题**,准确地告诉我们什么是错的。 “它不起作用”不是问题陈述。 –