ActiveX 连的?
自己写个方法混淆一下吧,连的时候方法弄隐蔽点,或者把连接方法写成字符串,在比较隐蔽的地方 eval 执行
或者 <script src="conn.jsp"></script>连接写在 conn.jsp 里面,conn.jsp 写个session验证,无法直接访问,里面放连接方法好像可以还是建议放到后台,或者用 ajax

解决方案 »

  1.   

    我这有个例子:
    js中sql语句字段名和表名一定要加[]
    function getCountFromDB() {
        //以当前页面文件为基础,找到文件所在的绝对路径。
        // ss.htm本页的文件名
        var filePath = location.href.substring(0, location.href.lastIndexOf("ss.htm"));
        var path = filePath + "info.mdb";
        //去掉字符串中最前面的"files://"这8个字符。
        path = path.substring(8);
        var updateCnt = 0;
     
       
     
        //建立连接,并生成相关字符串 
        var con = new ActiveXObject("ADODB.Connection");
        con.Provider = "Microsoft.Jet.OLEDB.4.0";
        con.ConnectionString = "Data Source=" + path;
        con.open;
     
         var sqlUpdCnt = "UPDATE [表名] SET [gz] = 2000.55 where [id]=1";
        sqlUpdCnt = sqlUpdCnt;
        con.execute(sqlUpdCnt);
     
        con.close();
        con = null;
    }