if (window.confirm("是否确认删除选中的数据?")) {
//执行删除
with (document.getElementById("userForm")) {
method = "post";
action = "user_maint.jsp?command=delete"
submit();
}
}with不明白什么?

解决方案 »

  1.   

    可以理解为,with后面{}的内容都是作用于with的那个对象with (document.getElementById("userForm")) {
    method = "post";
    action = "user_maint.jsp?command=delete"
    submit();
    } 相当于
    var formObj = document.getElementById("userForm");
    formObj.method="post";
    ....
      

  2.   

    with (document.getElementById("userForm")) { 
    method = "post"; 
    action = "user_maint.jsp?command=delete" 
    submit(); 
    } 相当于
    var userForm = document.getElementById("userForm");
    userForm.method = "post";
    userForm.action = "user_maint.jsp?command=delete"
    userForm.submit();