不能这样做
"+addusername.value+"','"+adddixing1.value
这两个值用request接收

解决方案 »

  1.   

    老兄:这样是行不通的,你搞清楚谁在server端执行,谁在client端执行先
      

  2.   

    出现的错误是:
    Microsoft VBScript 编译器错误 错误 '800a03f6' 缺少 'End' /iisHelp/common/500-100.asp,行242 Microsoft JScript 编译错误 错误 '800a03ec' 缺少 ';' /webpublish/user.asp,行40 dim sqlstr这是为什么呢?
      

  3.   

    我不是给你说了吗<%...%>在server端执行,js在client端不能通过客户端条件判断是否执行服务器端程序.
      

  4.   

    你判断后可另开一页面window.open(xxx.asp?...
      

  5.   

    不行,服務器端腳本無法接受到addusername.value,adddixing1.value必須提交後處理
      

  6.   

    只能form提交進行處理用xmlHttp觸發一個文件<script>
    function aa()
    {
    a=new ActiveXObject("Microsoft.XMLHTTP")
    a.open("GET","handler.asp?value1="+addusername.value,false)
    a.send()
    }
    </script>
      

  7.   

    这是我的改动之后的代码,麻烦大家给我看看:
         a.asp
    function adduser()
    {
    if(document.form1.addusername.value=="")
    alert("用户名不能为空");
    else
    {
    if(document.form1.addpassword.value==document.form1.addenpassword.value)
    {
    var sqlstr="";
    var checkcount=0;
    sqlstr+="'"+document.form1.addusername.value+"','"+document.form1.addpassword.value+"'";
    var arrInput = document.form1.getElementsByTagName("input");
    for(var i=0;i<arrInput.length;i++)
    {
    if(arrInput[i].type == "checkbox")
    {
    if(arrInput[i].checked)
    {
    arrInput[i].value="yes";
    sqlstr+=",'yes'";
    checkcount++;
    }

    else
    {
    arrInput[i].value="no";
    sqlstr+=",'no'";
    checkcount++;
    }
    }
    if(checkcount==15)
    break;
    }
    alert(sqlstr);
    var a=new  ActiveXObject("Microsoft.XMLHTTP"); 
    a.open( "GET","insertPower.asp?value="+sqlstr,false);
    a.send(); 
    }
    else
    alert("密码不一致");
    }}提交到页面insertPower.asp中
    <%
    insertStr=trim(Request.QueryString("value"))
    dim sqlstr
    sqlstr=""
    set conn = Server.CreateObject("ADODB.connection") 
    conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=e:\webpublish\UserAdmin.mdb" 
     
    sqlstr="INSERT INTO POWER (USER,PASSWORD,WORKWEB,PLAN1,PLAN2,DIZHI1,DIZHI2,DIMINGKU1,DIMINGKU2,500MAP,2000MAP,10000MAP,250000MAP,5WEIPIAN,22000HANGPIAN,3000HANGPIAN,GUANXIAN) VALUES ("+
    insertStr+")"
    conn.Execute sqlstr
    conn.close
    set conn=Nothing
    %>为什么页面insertPower.asp没有被执行呀?
      

  8.   

    ///以下为页面函数 ------------------------------
    function ChangeDepartment()
    {
    document.auditReport.jspDepartmentPerson.length = 0;        var i = 0;
            for ( i = 0 ; i< jsPersonSize; i++)
            {
                    //begin jscript
                if (document.auditReport.jspDepartment.value==jsDepartmentID[i])
                {
    // document.auditReport.jspDepartmentPerson.value = "0";                //begin jscript
                        document.auditReport.jspDepartmentPerson.options[document.auditReport.jspDepartmentPerson.length]=new Option(jsPeronName[i],jsPersonID[i]);
                    //end jscript
                }        }
            if (document.auditReport.jspDepartment.value=="审批结束")
      {
    document.auditReport.jspDepartmentPerson.options[document.auditReport.jspDepartmentPerson.length]=new Option("END","<%=GeReportState.GE_REPORT_LAST_MAN %>");
      }  //end of jscript if
    }
    ///以下为页面函数 ------------------------------    END这是定高
    比你的效率高多了!
      

  9.   

    ///以下为页面函数 ------------------------------
    function ChangeDepartment()
    {
    document.auditReport.jspDepartmentPerson.length = 0;
    <%
    Vector tmpDepartment2 = new Vector ();
    Department tmpClass2 = new  Department(); DReportPerson tmpDReportPerson2 = new DReportPerson(); tmpDepartment2 = tmpDReportPerson2.getAllDepartmentInTrafic() ;
    for (int i = 0 ; i< tmpDepartment2.size(); i++)
    {
    int m_DepartmentID = 0;
    tmpClass2 = (Department)(tmpDepartment2.elementAt(i));
    m_DepartmentID = tmpClass2.getDepartmentId();
    %>
                        //begin jscript
    if (document.auditReport.jspDepartment.value=="<%=m_DepartmentID%>")
    {
    document.auditReport.jspDepartmentPerson.value = "0";
                            //end of jscript
    <%
                            Vector vectorperson  = tmpDReportPerson.getAllPersonIDByDepartmentID(m_DepartmentID);
                            if (vectorperson != null)
                            {                            for(int j = 0; j< vectorperson.size() ; j++)
                                {
                                    int vectorperson_id = ((Integer)vectorperson.elementAt(j)).intValue() ;
                                    String vectorperson_name = tmpDReportPerson2.getPersonNameByID(vectorperson_id) ;                                %>
                                    //begin jscript
                                        document.auditReport.jspDepartmentPerson.options[document.auditReport.jspDepartmentPerson.length]=new Option("<%=vectorperson_name%>","<%=vectorperson_id%>");
                                    //end jscript
                                    <%
                                }
                            }
                            %>
    }  else if (document.auditReport.jspDepartment.value=="审批结束")
                              {
                                document.auditReport.jspDepartmentPerson.options[document.auditReport.jspDepartmentPerson.length]=new Option("END","<%=GeReportState.GE_REPORT_LAST_MAN %>");
                              }  //end of jscript if
    <% }
    %>
         }
    ///以下为页面函数 ------------------------------    END这个能用,太慢了
      

  10.   

    给你两个意见:
    一。在不同的文件中处理,具体用到哪个文件看你的script怎么控制了;
    二。把数据库的东西先读出来放在一边,然后调用(就像缓冲)。
      

  11.   

    给你一个最简单的 javascript 中调用vbscript 的方法:
    <script>
    tt="2003-01-02"
    execScript('i=IsDate(tt)','vbscript')
    if(i)alert("tt is right")
    else alert("tt format isn't right")</script>
      

  12.   

    楼上你真逗,
    我一开始,也以为是这种问题,
    后来一看,
    人家是IIS的,VB是服务器脚本,
    不是两种客户端脚本的混用问题!