<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>author:meixx</title>
<script language="javascript">
var pWin=window.open("","");
function initTable(){
pWin.focus();
}
</script>
</head><body onreLoad="initTable()">
ssdfsdf
</body>
</html>

解决方案 »

  1.   

    问题在这里:
    var pWin=window.open("",""); // 问题在这里
    function initTable(){
    pWin.focus();
    }应该给新开窗口加上名字,比如"newWin",这样open时,如果已经open过会自动找已经打开的窗口。
    var pWin=window.open("newWin",""); 
    pWin.focus();
      

  2.   

    to: FJGoodGood(_FJ_强中强) 
    问题已不在于能否对应他的窗体.而是怎么样使他的子窗体重新或得焦点并且不是重新加载.
      

  3.   

    1.模态窗口的打开
    2.模态窗口的关闭
    3.模态窗口的传递参数。
    4.其他。
    1.window.showModalDialog("DialogPage.aspx","newwin","dialogHeight: 200px; dialogWidth: 150px; dialogTop: 458px; dialogLeft: 166px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;");2.window.close();3.传值
    ParentPage.aspx:
    window.showModalDialog("DialogPage.aspx?para1=aaa&para2=bbb");DialogPage.aspx:
    string str1=Request.QueryString["para1"].toString();
    string str2=Request.QueryString["para2"].toString();返回值
    DialogPage.aspx:
    window.returnValue="aaa";ParentPage.aspx:
    var str=window.showModalDialog("DialogPage.aspx");4.
    aspx页面在showmodeldialog情况下为什么一提交就重新打开一个页面?
    showmodaldialog打开的页面中在<head></head>之间加入一行:<base target="_self">
      

  4.   

    例子 
    WebForm2.aspx.vb
        Inherits System.Web.UI.Page
        Protected WithEvents Button1 As System.Web.UI.WebControls.Button
        Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
        Protected WithEvents Button2 As System.Web.UI.WebControls.Button
        Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Button1.Attributes.Add("onclick", "var st=window.showModalDialog('user.aspx?val='+document.all('TextBox1').value);document.all('TextBox1').value=st;return st;")
        End Sub
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            RegisterStartupScript("key", "<script>window.opener=null;window.close(this);</script>")
        End Sub
    user.aspx.vb
        Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
        Protected WithEvents cancel As System.Web.UI.WebControls.Button
        Protected WithEvents ok As System.Web.UI.WebControls.Button
        Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox    
        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim str As String
            If Not IsPostBack Then
                str = Request.QueryString("val")
                TextBox1.Text = str
            End If
        End Sub
        Private Sub cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel.Click
            RegisterStartupScript("key", "<script>window.returnValue='null';window.opener=null;window.close(this);</script>")
        End Sub
        Private Sub ok_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ok.Click
            RegisterStartupScript("key", "<script>window.returnValue=document.all('TextBox2').value;window.opener=null;window.close(this);</script>")
        End Sub
      

  5.   

    多谢 各位的热情接待帮助
    to goody9807() :
    现在的情况是非模式窗口问题
      

  6.   

    html>  
    <head>  
    <SCRIPT LANGUAGE="JavaScript">  
    function openwin()  
    {  
    OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");  
    //写成一行  
    OpenWindow.document.write("<TITLE>例子</TITLE>")  
    OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")  
    OpenWindow.document.write("<h1>Hello!</h1>")  
    OpenWindow.document.write("New window opened!")  
    OpenWindow.document.write("</BODY>")  
    OpenWindow.document.write("</HTML>")  
    OpenWindow.document.close()  
    }  
    </SCRIPT>  
    </head>  
    <body>  
    <a href="#" onclick="openwin()">打开一个窗口</a>  
    <input type="button" onclick="openwin()" value="打开窗口">  
    </body>  
    </html>
      

  7.   

    <script>
    var x
    function test(){
    x=window.open("vv.html");
    x.name="KKK";}
    function test2(){
    x=window.open("","KKK");
    x.focus();
    alert(x.location);
    }
    </script>
    <input type=button onclick="test();" value="刷新前打开">
    <input type=button onclick="test2();" value="刷新后">
      

  8.   

    如果不希望b被重新加载我想使用ocx可以很容易的实现(主要还要看你的应用场景),因为你希望将一个IE窗体置前,这个已经超出了脚本所能达到的范围。所以建议你如果非要实现该功能就写一个签名的ocx(签名是为了安全,毕竟现在ocx不太受欢迎)。
      

  9.   

    难题是页面刷新后,没法在访问和获得子窗口对象了,我想到一个比较变态的办法,不知你愿不愿意尝试:把主窗口上升为Frameset的方式,可以只有一个Frame,原来的主页面放在这个Frame里面,打开子页面后,把子窗口对象保留在Frameset窗口里面的某个JavaScript变量里,下次主页面重新刷新后,判断parent里有没有这个窗口变量,如果有,就focus(),例如://打开子窗口
    if (parent.ChildWnd == null)
    {
        parent.ChildWnd = window.open("xxx");
    }
    parent.ChildWnd.focus();//子窗口关闭时:
    opener.parent.ChildWnd = null;
      

  10.   

    "把子窗口对象保留在Frameset窗口里面的某个JavaScript变量里"
    --------IE的工具条上的“刷新”按一下,一样完蛋。
      

  11.   

    to:
    hhjjhjhj(大头)(想变胡萝卜^^) ( 
    说得也是