日期:2014-05-16  浏览次数:20404 次

js高手帮个忙,提交后input表单值只能得到一个,丢失了另一个,怎么改正都得到?
<script>
function checkForm()
{
 if (document.AddUserForm.mid.value=="")
 {
  alert("id号不能为空!");
 }
 else if (document.AddUserForm.card_id.value=="")
 {
  alert("身份证号码不能为空!");
 }
 else {
  document.AddUserForm.submit();
 }
}
</script>
<form name=AddUserForm METHOD="post" action="cy.php">
  <span id="pass">
<input type=password id="card_id" name="card_id" value="123456" size=25>
</span>
<INPUT TYPE="checkbox" id="showPass"  
onclick="
var temp=document.getElementById('card_id').value;
if(this.checked){
document.getElementById('pass').innerHTML='<input type=text autocomplete=off id=card_id name=card_id size=25>';
}else{
document.getElementById('pass').innerHTML='<input type=password id=card_id name=card_id size=25>';
}  
document.getElementById('card_id').value=temp;
"
<input type="text" name="mid" value="22"> 
<input type="submit" value="提交" onclick="Javascripts:checkForm();return false;">



提交后可以得到card_id传递的值,但得不到mid的值,请问怎么改正才能都得到?谢谢!

------解决方案--------------------
<INPUT TYPE="checkbox" id="showPass" ... />

这个input标签没有正确关闭,漏掉了结束标签/>