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

ID/NAME 所引用的元素位于全局范围。请使用 W3C 的标准形式 document.getElementById()
JScript code
function commitEvent(){
    
    var withdraw=document.getElementById("withdraw").value;
    var bankname=document.getElementById("bankname").value;
    var banknumber=document.getElementById("banknumber").value;
    var holder=document.getElementById("holder").value;
    var way=document.getElementById("way").value;
    var usertype=document.getElementById("usertype").value;
    var param = {"withdraw":withdraw,"bankname":bankname,"banknumber":banknumber,"holder":holder,"way":way,"usertype":usertype,"act":commit};
     $.ajax({
            type:"get",
            url:"carry_application_do.jsp",
            data:param,
            dataType:"boolean",
            success:function(s){
                if(s){
                    alert("申请成功!");
              }else{
                    alert("网络繁忙,请稍后在尝试!");
                    
                }
            
            }
            });
    
}

以上声明的变量都可以alert到值 但是总是报错ID/NAME 所引用的元素位于全局范围。请使用 W3C 的标准形式 document.getElementById() 。
var param = {"withdraw":withdraw,"bankname":bankname,"banknumber":banknumber,"holder":holder,"way":way,"usertype":usertype,"act":commit};

------解决方案--------------------
不是有ById吗?

firebug看看 具体是哪一行?
------解决方案--------------------
是不是commitEvent内部的变量也定义在外部了,改一下试试..
------解决方案--------------------
是不是命名起冲突了? 把形如 withdraw 换为:withdraw_value 试试。