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

Javascript验证在IE中有效,在FF中无效,怎么办?
<script   type= "text/JavaScript ">
<!--
function   confrim_guest(){
if   (guestbookForm.guestName.value   ==   " "   ){
alert( "姓名不能为空! ");
guestbookForm.guestName.focus();
return   false;
}
}
//-->
</script>

<div   id= "bt ">
            <input   type= "submit "   name= "Submit "   onClick= "return   confrim_guest(); "   value= "   提   交   "   />
        </div>

------解决方案--------------------
把guestbookForm.guestName改成又getElementById方法获取!!!
------解决方案--------------------
楼上正解..
------解决方案--------------------
document.guestbookForm.guestName.
------解决方案--------------------
document.all.idName||document.idName||idName.在ie里边没有太大限制可是在FF里就不一样了!
建议楼主按楼上说滴改为用document.getElementById( "idName ")....