通过添加按钮添加额外字段的此查询正在Google chrome上工作,但不在Internet Explorer中。请帮我解决它在IE 11中。通过添加按钮添加额外字段
<html>
<head>
<script>
function add_field()
{
var form = document.getElementsByTagName('form')[0],
input = document.createElement('input');
input.setAttribute('type', 'text');
input.setAttribute('name', 'item');
form.appendChild(input);
};
</script>
<form name="input" method="get">
<div class="ui-input-text">
<input type="text" name="item"><br>
<div data-role="navbar">
<button type="button" onclick="add_field
()">ADD</button><br>
</div>
</div>
</form>
</body>
</html>
在IE9中工作正常。 – ponciste
Javascript控制台中是否有任何错误? – Barmar
为什么使用全局变量'input'而不是局部变量? – Barmar