从服务器端取值并更回填到页面(showModelessDialog方式)
http://jkisjk.vip.sina.com/html/getDataFromServer.htm

解决方案 »

  1.   

    在<select></selelct>之间引入一个jsp文件,jsp的内容根据需要生成
      

  2.   

    在<select></selelct>之间引入一个jsp文件,jsp的内容根据需要生成但我的是输入框啊,不是下拉的
      

  3.   

    从服务器端取值并更回填到页面(showModelessDialog方式)  
    http://jkisjk.vip.sina.com/html/getDataFromServer.htm 这个例子如何传,获取参数啊?提交到一个隐藏的帧中,由帧中的脚本改写 具体怎么做啊?谁来帮我啊?
      

  4.   

    用一个hidden的frame提交,把取回来的数据写到文本框里
      

  5.   

    liugmwx(面对面) ,因为我对javasript 很不熟,能不能有一些类似的代码让我参考呢?
      

  6.   

    用以下javascript如下:var  conn  = new  ActiveXObject("ADODB.Connection");  
    conn.Open("Provider=sqloledb;  server=192.168.0.1;  uid=a;  pwd=b;database=writ;Persist Security Info=False"); 
    var  strSQL  =  "Select  *  From  CompanyName where C_code='4407920033' ";  
    var  rs  =  new  ActiveXObject("ADODB.Recordset");  
    rs.Open(strSQL,conn) 
    aa=rs.Fields(1)本机可以运行,但是会弹出“正在访问外部数据源,是否继继?”
    其它机器干脆就是错误
    不知大家有没有遇到这种情况,有如何方法解决?
      

  7.   

    访问数据库不应在JavaScript,用asp.net
      

  8.   

    如果在asp的话,应如何处理呢?
      

  9.   

    回复人: mmxy(毛毛雨) ( ) 信誉:100  2005-01-17 16:54:00  得分: 0  ----------
    这段代码不仅会有IE的安全限制
    而且会造成数据库密码的公开,因为浏览者可以通过查看源文件看到数据库用户密码等。
    再,你的网址:192.168.是内部网吧,局域网外的用户也不能直接用这个IP。一楼的网址里已有四种方式可供选择,
    具体代码查看源文件就知道了
      

  10.   

    从服务器端取值并更回填到页面(showModelessDialog方式)
    http://jkisjk.vip.sina.com/html/getDataFromServer.htm
    我试了,就是不知如何解决啊?如何取参数?<script>
    function getDataFromServer()
    {
    var a
    a=11
    document.all.b.value="";
    window.showModelessDialog("getDataFromServerDialog.asp",window,"status:no;resizable:no;help:no;dialogHeight:30px;dialogWidth:200px;");
    }
    </script><script>
    windowArguments=window.dialogArguments;function returnFun()
    {
    //var  code=document.form1.CopanyName.value
    var  conn  = new  ActiveXObject("ADODB.Connection");  
    conn.Open("Provider=sqloledb;  server=192.168.0.1;  uid=jmeport;  pwd=eport;database=writ;Persist Security Info=False"); 
    var  strSQL  =  "Select  *  From  CompanyName where C_code='4407920033' ";  
    var  rs  =  new  ActiveXObject("ADODB.Recordset");  
    rs.Open(strSQL,conn) 
    var aa
    aa=rs.Fields(1)
    //if (rs.RecordCount<=0) {document.form1.CopanyName.value=rs.RecordCount;}
    //rs.Close();          //  关闭记录集合  
    //conn.Close(); 
    windowArguments.document.all.b.value=aa;
    window.close();
    }setTimeout("returnFun()",00);
    </script>
      

  11.   

    windowArguments.document.all.b.value=aa;如果仅是静态的就可以,服务器好像并不执行数据查询的
      

  12.   

    就是服务器处理返回这一段:
    <script>
    windowArguments=window.dialogArguments;function returnFun()
    {
    windowArguments.value="dataFromServer";
    window.close();
    }setTimeout("returnFun()",100);
    </script>
    我试了在javasritp里面写代码访问数据库,但是程序并没有执行。
    如果写在asp里面呢?如何与javacript通讯?
      

  13.   

    -------getDataFromServerDialog.asp------
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>JK:支持民族工业,尽量少买X货</title>
    </head><body >
    <h5 align=center valign=middle >正在查找资料</h5>
    </body></html>
    <%
    !这里是你服务端方问数据库的代码(代码略),访问的结果如下:
    Dim dataFromServer="name"%>
    <script>
    windowArguments=window.dialogArguments;function returnFun()
    {
    windowArguments.value="<%=dataFromServer%>";//注意这一句
    window.close();
    }setTimeout("returnFun()",100);//这一句是为了演示在网整很慢(或服务端反应很慢)时的效果
    //可以改为:returnFun();
    </script>
      

  14.   

    呵呵,搞好了
    windowArguments.value="<%=dataFromServer%>";//注意这一句原来我就错了这一句,我是这样用的:
    windowArguments.value=<%=dataFromServer%>;不过之后我用了另一种方法也行,将值放在一个隐蔽框中,用:
    windowArguments.value=document.form1.aa.value;
    也行
      

  15.   

    回复人: mmxy(毛毛雨) ( ) 信誉:100  2005-1-19 10:16:45  得分: 0  
    不过我想要这样的效果,不要打开的那个页面框,一点也不要出现-----------
    一楼给的链接里有四种方式可供选择,
    其中第三种和第四种就是这样的效果
      

  16.   

    六楼网友所说ice_berg16(寻梦的稻草人)的xmlhttp,应该就是指一楼链接的第四种方式。
      

  17.   

    主窗口:
    function childauto(str_value){    
       selectdname.autosumbit(str_value);// 传值到子窗口并执行子窗口的fun
    }
    function checkdata(return_value){  //得到子窗口返回的值
       
    }
     <div  style="VISIBILITY: hidden">
    <IFRAME ID="selectdname" src="子窗口" frameborder="0" scrolling="no" width="0" height="0"></IFRAME> 
    </div> 
    子窗口:
    function autosumbit(ss){ 
       window.location="子窗口.jsp?dno="+ss;//按收父窗口传回的值并执行子窗口进行查询
    }
    function returnitem(strren)

       parent.checkdata(strren); //将子窗口得到的值返回给父窗口
       window.location="子窗口";
    }
    子窗口执行查询语句后将得到的值瑞执行returnitem()