昨天问题的附加```就是说click新建按钮后,弹出页面B,再次click新建按钮,不弹出页面B,而是激活页面B,这个解决了`````
问题是如果在页面B先输入了一些信息,这个时候再次点击新建按钮,虽然激活了页面B,但是页面B中的内容就清空了```有没有什么办法就是点击新建按钮的时候,激活页面B并且保留页面B之前输入的内容呢```

解决方案 »

  1.   

    http协议是无状态的
    要想保留,只能利用viewstate或
    cookie,session
      

  2.   

    我测试通过<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <script type="text/javascript">
        var o ;
        function show()
        {
           if (!o)
           {  
                o = window.open("default2.aspx","起个名字");
                o.focus();         
           }
           else
           {
                o.focus();
           }
           
        }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <input id="Button1" type="button" value="button" onclick="show()" />
        </div>
        </form>
    </body>
    </html>
    至于default2, 你随便放几个textbox试下就行了
      

  3.   

    不对. 我做的是B页面不关闭的情况下 激活.. 关闭就得用cookie了
      

  4.   

    LS的```你这个办法如果把B页面关闭后,再次点击新建按钮就会出错了吧~
      

  5.   

    a.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script type="text/javascript">
        var newWindow ;
        function show()
        {
           if (newWindow)
           {  
                 newWindow.focus();             
           }
           else
           {
                newWindow = window.open("b.html","name");
                newWindow.focus();         
           }
           
        }
        </script>
    </head>
    <body>       
            <input id="Button1" type="button" value="click me" onclick="show();" />    
        
    </body>
    </html>
    b.html<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html >
    <body onbeforeunload='opener.newWindow=null;opener=null;'>
    <input type='text' />
    <input type='text' />
    </body>
    </html>