document.createElement("INPUT")初级问题!
<script>
function createInput(){
if(document.all.jsq.value=='')
{
document.all.jsq.value=1;
}
else
document.all.jsq.value=document.all.jsq.value+1;
var sn='arrr'+document.all.jsq.value;
var a=document.createElement("<INPUT onChange=createInput()>");
a.setAttribute("type","text");
a.setAttribute("name","sn");
a.setAttribute("id","sn");
document.body.appendChild(a);
var sww='arrr'+document.all.jsq.value;
alert(document.getElementById("sn").value)//正确的
alert(document.getElementById("sww").value);//错误的!
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<script>createInput()</script>
<form name="form1" method="post" action="">
<input type="text" name="var1" onChange="createInput()">
<input type="text" name="jsq" value=1>
<input type="text" name="temp1">
<input type="submit" name="Submit" value="提交">
</form>
<div id="content"></div>
</body>
</html>
____________________________________
没有明白怎么都是一样的,一个对,一个说没有对象,我是初学者!想得到所有动态input中的值!