这是我现在在博客文章中的 Javascript 和 HTML 代码。
<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<script language="javascript" type="text/javascript">
function convertinput() {
document.getElementById('output').value = "@@[0:[0:1: " + document.getElementById('first').value + "]]";
document.getElementById('output').style.display = 'block';
}
</script>
<input id="first" maxLength=75 style="WIDTH: 300px;></input>
<br>
<input id="output" style="display:none;"></input>
<br>
<input type='button' onclick='convertinput()' value='convert'>
</div>
我无法在输入文本框中插入空格。
这是什么原因呢?解决办法是什么?
最佳答案
您缺少结束语"
在style="WIDTH: 300px;>
另一件事是</input>
不是标签结束。它必须以这种方式关闭:
<input type="text" />
关于javascript - 允许 HTML 文本框中有空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13138686/