下面是简单的代码,更新与输入的字段由用户输入。但是,更新没有发生。任何人都可以让我知道这个问题吗?
<html>
<head>
<title>Rooms</title>
<script type="text/javascript">
function populate()
{
var newName = document.getElementsByName("roomNameInput").value;
document.getElementsByName("nameDisplay").value = newName;
}
</script>
</head>
<body>
<h3>Configure: </h3><i name="nameDisplay"></i><br />
Enter the Room name: <input type="text" name="roomNameInput" onkeypress="populate()"><br />
</body>
</html>
试图与document.getElementsByName("nameDisplay").innerHTML
但未能
试过..无法正常工作或 – 2011-05-20 00:00:23
所做的更改..越来越不确定,我需要显示的文本输入。 – 2011-05-20 00:08:18
将'onkeypress =“populate()”'改为'onkeypress =“填充”' - 将大括号作为处理程序执行该函数 – Zirak 2011-05-20 00:10:45