<!--CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dt-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>js动态创建input,ie下设置name无效</title>
<mce:script type="text/javascript"><!--
add = function(){
var div = document.getElementById("add");
var input = document.createElement("input")
input.setAttribute("type","text")
input.setAttribute("name","file")
var del = document.createElement("input")
del.setAttribute("type","button")
del.setAttribute("value","删除")
var br = document.createElement("br");
div.appendChild(input)
div.appendChild(del)
div.appendChild(br)
del.onclick = function(){
div.removeChild(input)
div.removeChild(del)
div.removeChild(br)
}
}
// --></mce:script>
</head>
<body>
<div id="add">
<input type="text" name=""file" />
<input type="button" value="添加" onClick="add()" />
<div>
</body>
</html>