在iframe的页面里隐藏一个form,你新打开的窗口的查询参数传到他里面,不就行了

解决方案 »

  1.   


       to  kingdomzhf(旭日东升):       拜托阁下认真阅读我对问题的描述,如果认为什么地方我没说清楚,尽管告诉我!   to 大家:       最好能给我写段贴切的例子,我刚刚接触"瘦客户端"开发,JavaScript方面的知识很薄弱,如果就是那么简单一说,我很难理解要如何去做.
      

  2.   

    你如果能在别的页面得到正确查询结果,可以让你在这个iframe中显示出这个查询结果。方法就是在子画面中隐藏一个div,div中包含查询到的结果,结果放在div下的table中。然后在主页面的simple iframe中定义嵌套的两个table,这里我们可以给他们其名字parentTbl和sunTbl,在点按钮出子画面的时候,你就把查询条件发到servlet中去,这样子画面一出来div中就有数据。在子画面中写一个函数,函数的参数是子画面中table的innerHTML属性,当点击“提交”按钮之后,把这个innerHTML属性发送到主页面的js文件中,然后用simple.parentTbl.rows[0].cells[0].innerHTML=传过来的innerHTML,这里有一点需要注意,就是simple中的parentTbl需要有隐藏行。替换过去之后把隐藏的显示出来就可以了
      

  3.   

    切记,子画面的table和sunTbl一定要结构完全相同
      

  4.   

    为何不直接将表单提交到你需要的iframe里?
      

  5.   

      to 各位:    能不能有简单一些的办法呢?    就是通过子窗口的一个"提交"按钮,去刷新主页面main.jsp里的一个<iframe>里的内容,    只要能做到“刷新”就行!也就是showresult.java这个Servlet能被重新加载一次,main.jsp里<iframe>标记的document对象有没有reload()之类的函数呢?   主窗口和子窗口实际上是两个浏览器,可以通过opener对象来通讯,那么子窗口“提交”按钮的onclick事件可不可以这样写呢:    onclick="javascript:self.opener.frames[simple].location.href='/showresult';"   或    onclick="javascript:self.opener.frames[simple].document.reload();"
       如果加上1)小点的想法,那么这样写可以么?   onclick='javascript:document.queryform.submit();self.opener.frames[simple].document.reload();self.opener=null;self.close();'   实在不行我就放弃了吧,都在一个浏览器窗口里做算了,所有的问题都迎刃而解了!
      

  6.   

         这个问题也是很常见的应用啊,WEB开发版的同仁应该有解决类似问题的经验吧?  
      

  7.   

    tryonclick="javascript:self.opener.top.frames[simple].document.reload();"
      

  8.   

    楼主,你是不是要刷新吗?
    写个自动刷新的函数,然后onclick调用不就OK了吗?
    var limit="0:01 
    function beginrefresh(){ 
    if (!document.images) 
    return 
    if (parselimit==1) 
    self.opener.top.frames[simple].document.reload();
    else{ 
    parselimit-=1 
    curmin=Math.floor(parselimit/60) 
    cursec=parselimit%60 
    if (curmin!=0) 
    curtime=curmin+"分"+cursec+"秒后重刷本页!" 
    else 
    curtime=cursec+"秒后重刷本页!" 
    window.status=curtime 
    setTimeout("beginrefresh()",1000) 

    }
      

  9.   


       to longshenwang(清一色!一条小青龙):      没反应
      

  10.   


        to AgathaZ(游弋的小鱼);      self.opener.top.frames[simple].document.reload(); //这句没有起作用
      

  11.   

    to  zyymmm(今宵酒醒何处,杨柳岸,晓风残月)如果没反映 在代码没有书写错误的情况下 原因可能是因为你的框架显示的不是jsp页面 而是servlet的缘故!
      

  12.   


        
         请问大家:       如果我放弃了上述想法,所有的事情都在一个浏览器窗口里做,又该怎么做呢?     就是:    原来在子窗口里的那个查询表单,现在我把它放到主窗口(main.jsp)的右方,   就是放到<iframe name=detail>这个框架里,添完查询条件后,我点"提交"按钮,把查询结果提交到<iframe name=simple>这个框架里,同时<iframe name=detail> 内容清空,如果不清空,查询结果同样会显示在窗体右方的<iframe name=detail>里.  请问如何做呢?如下可以么?    <form action="某某Servlet">
         .
         .
      <input type=submit value="提交" onclick="JavaScript:simple.location.href=/showresult;detail.location.href=about:blank">
     
        </form>  这样可以么????
      

  13.   

    <form target="窗口名">真是很佩服,把一个简单的问题描述的那么复杂
      

  14.   


       to  xuzuning(唠叨):     target="窗口名" ---->[窗口名] 是我要显示概要查询结果的那个<iframe name=simple>么?     也就是"窗口名"=simple  ,是这样的么?
          
      

  15.   


       现在,在main.jsp里有一个button,如下:   <input type="button" value="人要素查询" name="people" style="background-color:#D1D5BA;"  onclick="Javascript:detail.location.href='/showcondition'">   我的期望:
     
       点击后在<iframe name=detail>里出现一个查询用的表单,也就是showcondition.java
    但为什么不好使?
       如果用超连接就好使,因为<a>标记有一个target的属性,象这样:   <a href="controlservlet?action=showcondition&objName=people" target="detail">人要素查询</a> 
       
       为了界面美观,我想用<input type="button" value="人要素查询">,请问应该如何做?
       
      

  16.   

    你想把他命名成什么那是你的事情。
    请注意以下事实:
    p.htm
    <iframe name="test"></iframe>
    <script>
    open("ps.htm");
    </script>ps.htm
    <form target="test">
    <input type=text name=ppp value=123>
    <input type=submit>
    </form>在弹出的窗口中点击提交,看看原窗口中是什么
      

  17.   


         to    xuzuning(唠叨):
     
         我还有一个问题:     在<iframe name=detail>里有一个下拉框,如下:
     
         <select size=1 name=operation onchange='location=this.options[this.selectedIndex].value' style='width:80px;margin:-1'>     <option value='controlservlet?action=associationquery>关联查询1</option>     </select>
         现在我点“关联查询1”就会得到关联查询结果,我想把结果显示在main.jsp左上角的那个<iframe name=simple>里,又应该怎么做呢?
         
         我查了一下,<select>标记和<option>标记没有target属性,     所以我这样:
         
         <form name=help target=simple>     <select size=1 name=operation onchange='location=this.options[this.selectedIndex].value' style='width:80px;margin:-1'>     <option value='controlservlet?action=associationquery>关联查询1</option>     </select>
     
         </form>    但不好使,请问我应该怎么做呢?
      

  18.   

    你可以用select 的onchange事件控市 页面显示
      

  19.   


        to  longshenwang(清一色!一条小青龙) :        能给我写一段示例代码么?  感谢之至。
      

  20.   

    楼下那个 叫zhfkiller(杀手)  的是高手叫他帮你啊!!
      

  21.   


       to longshenwang(清一色!一条小青龙):   哦   to zhfkiller(杀手) :   能帮帮我么?   我现在正在着手解决第三个问题,就是:   在main.jsp的左上方和左下方分别有一个<iframe>标记,他们是:   <!-- 显示在页面左上角部位,用于显示概要查询结果 -->     <iframe name="simple" src='/showresult'>   <!-- 显示在页面左下角部位,用于显示查询动作历史列表 -->     <iframe name="history" src='/showhistoryresult'>
       我的期望:   在点击<iframe name="simple" src='/showresult'>里的超连接时,<iframe name="history" src='/showhistoryresult'>里记录并显示曾经点击过的“查询动作”,以便进行“历史回朔”查询。   现在“点击动作”我有办法记录下来,并传递给<iframe name="history" src='/showhistoryresult'>里的Servlet--->showhistoryresult.java.   但却没有办法显示。
       我在点击<iframe name="simple" src='/showresult'>里的超连接时,做了如下处理: <a href='controlservlet?action=detailquery&detailpara=某个参数' target='detail' onclick='document.frames[history].location.href =/showhistorylist'>
       却没有反应,请问我应该怎么做呢?   着急ing...
      

  22.   

    <a href='controlservlet?action=detailquery&detailpara=某个参数' target='detail' onclick='document.frames[history].document.write(this.href)'>
      

  23.   


       to longshenwang(清一色!一条小青龙):      谢谢!可是本版老大什么时候来呀?(好象从没见过他回答问题,-_-)
       to zhfkiller(杀手) :      听说你是高手,证明自己实力的时刻到了,呵呵~      拜托帮我看看这个帖子里我曾经提出过的问题,能回答多少就回答多少,拜托!拜托!      答案 ---> 我梦寐以求!
      

  24.   

    不知道你说的是不是这个意思main页面
    ----------
    <body>
    <div>
    <input type=button value="open wnd" onclick="popup()">
    <script language="JScript">
    function popup(){
    var pop = window.open('submit.htm');}
    </script>
    </div>
    <!-- 显示在页面左上角部位,用于显示概要查询结果 -->
    <iframe name="simple" src='/showresult'></iframe><!-- 显示在页面左下角部位,用于显示查询动作历史列表 -->
    <iframe name="history" src='/showhistoryresult'></iframe><!-- 显示在页面右方,用于显示详细查询结果 -->
    <iframe name="detail" src='/showdetailresult'></iframe></body>弹出的窗口提交页面submit.htm
    -----------------------
    <BODY><P>&nbsp;</P>
    <form name=form1 action="\showresult"><input type=submit onclick="window.close()"></form>
    <script>window.onbeforeunload = function () { 
    window.opener.document.frames("simple").location.reload(); 
    };
    </script>
    </BODY>
      

  25.   

    有空去看一下phpmyadmin查询部分的源代码。
    http://sourceforge.net/projects/phpmyadmin/
      

  26.   

    在主页面里面增加一个函数,比如叫
    function abc()
    {
    ...
    }
    在弹出窗口里面可以用window.opener.abc()来启动这个函数
      

  27.   


       
       在刷新历史列表那里:   我尝试过如下写法:      onclick='javascript:document.frames[history].document.reload();'
          onclick='javascript:parent.frames[history].document.reload();'      onclick='javascript:document.frames[history].location.reload();'
          onclick='javascript:document.frames[history].location.href='/showhistorylist';'      onclick='javascript:document.frames[history].location.write(this.href);'
         总是报告说:document.frames[history].location 或 parent.frames[history].document 或 document.frames[history].location 这些对象不存在,     这是怎么回事?
      

  28.   

    使用窗口名总是有效的,虽然稍微慢了点。
    <select size=1 name=operation onchange='simplelocation=this.options[this.selectedIndex].value' style='width:80px;margin:-1'>如果你想理顺各frame、iframe的次序,请在主文件里查看document.frames
      

  29.   

    [history].document 或 document.frames[history].location
    写得有问题,不是[]号见上面,我的方法试了吗?没有解决不了的问题
      

  30.   

         to xuzuning(唠叨):        你是说这样是吧:onchange='simple.location1 ...
      
            不好使啊     to yjgx007(谁是高手):
           
             我查了书,确实是[]号啊