无分]遍历表单

<SCRIPT LANGUAGE="JavaScript">
<!--
function fsubmit(sform){
str = '';
stre='';

for(i=0;i<sform.length;i++){
stre +=sform[i].tagName+"->"+sform[i].name+"="+sform[i].value+"\n";
}
alert(stre);

var a=sform.getElementsByTagName("input"); //遍历特定tag
for(var i=0;i<a.length;i++){
str +=a[i].name+'='+a[i].value+"\n";
}

//alert(str);
sform.submit();
}
//-->
</SCRIPT>
<form name="forma">
<input type=submit value=submit onclick="fsubmit(document.forma)">
</form>

你可能感兴趣的:(无分]遍历表单)