老板要我做一个这样的功能:有两个页面 a 和 b,点a 页面里的一个按钮,弹出一个新窗口b页面,b页面里有很多记录,每个记录前有个checkbox框,要求,勾选b页面里的
记录,提交后b页面关闭,选中的记录显示在a页面里,a页面显示这些记录的同时还要在每个记录后面跟个红叉,可以将显示在a页面的记录不要的删除掉。好象很难啊

解决方案 »

  1.   

    http协议是被动式的,你可以用数据库保存好b中的操作结果,然后a定时去取数据,然后q在更新,但不可能主动通知a去做什么的,这是http协议的游戏规则.
      

  2.   

    其实 我也只懂一点儿  
    楼主 查一下 Window.Opener方法 好像可以完成你想要的
      

  3.   

    类似的功能很常见
    有两个页面 a 和 b,点a 页面里的一个按钮,弹出一个新窗口b页面,b页面里有很多记录,
    --到这里因该很简单吧
    每个记录前有个checkbox框,要求,勾选b页面里的记录,提交后b页面关闭,
    --这里,在关闭前要处理一下,取出勾选记录的id,用opener.func(id)调用a页面的函数func,函数里将id提交到服务器,刷新页面。
    选中的记录显示在a页面里,a页面显示这些记录的同时还要在每个记录后面跟个红叉,可以将显示在a页面的记录不要的删除掉。
    --有了id,显示这些行普通了
      

  4.   

    不知道我的可以搞定不!
    假设a页面有个按钮<input type="button" value=" 打开页面 " onclick="openPage();">
    写你的js
    function openPage()
    {
      var result = dlgParentMul("DialogParent.jsp");
    if(result!=null && result!=""){
    clearFilters();
    var tmp=result.split("$");
    }
    function dlgParentMul(dialogurl,dWidth,dHeight){
      if(dWidth==null) dWidth=800;
      if(dHeight==null) dHeight=600;
      var strReturn=window.showModalDialo(dialogurl,"","dialogHeight:"+dHeight+"px;dialogWidth:"+dWidth+"px;dialogTop: tx;dialogLeft: tx;center:yes;help:no;resizable:no;status:no"); 
      return strReturn;
    }
    在DialogParent.jsp写一个iframe连到b页面。
    假设b有个提交按钮,<input type="button" value=" 打开页面 " onclick="referPage();">
    和两个checkbox,
    <html:checkbox styleId="natural" property="search_natural" value="1" />&nbsp;正常&nbsp;
    <html:checkbox styleId="affair" property="search_affair" value="1" />&nbsp;事假&nbsp;
    b的js
    function referPage()
    {
      var natural = document.getElementById("natural").value;
      var affair = document.getElementById("affair").value;
      self.parent.returnValue = natural + "$" + affair;
      self.parent.close();
    }
      

  5.   

    没写完就发出去了,不好意思。
    不知道我的可以搞定不!
    假设a页面有个按钮<input type="button" value=" 打开页面 " onclick="openPage();">
    写你的js
    function openPage()
    {
      var result = dlgParentMul("DialogParent.jsp");
      if(result!=null && result!=""){
        var tmp=result.split("$");
        if(tmp[0] == "natural"){
          //做你要做的处理,红叉等
        }
        if(tmp[1] == "affair"){
          //做你要做的处理,红叉等
        }
      }
    }
    function dlgParentMul(dialogurl,dWidth,dHeight){
      if(dWidth==null) dWidth=800;
      if(dHeight==null) dHeight=600;
      var strReturn=window.showModalDialo(dialogurl,"","dialogHeight:"+dHeight+"px;dialogWidth:"+dWidth+"px;dialogTop: tx;dialogLeft: tx;center:yes;help:no;resizable:no;status:no"); 
      return strReturn;
    }
    在DialogParent.jsp写一个iframe连到b页面。
    假设b有个提交按钮,<input type="button" value=" 打开页面 " onclick="referPage();">
    和两个checkbox,
    <html:checkbox styleId="natural" property="search_natural" value="1" />&nbsp;正常&nbsp;
    <html:checkbox styleId="affair" property="search_affair" value="1" />&nbsp;事假&nbsp;
    b的js
    function referPage()
    {
      var natural = document.getElementById("natural").value;
      var affair = document.getElementById("affair").value;
      self.parent.returnValue = natural + "$" + affair;
      self.parent.close();
    }
      

  6.   

    大致这样referPage()要改进一下……