Window.Open / Window.Close问题 [英] Window.Open / Window.Close question

查看:91
本文介绍了Window.Open / Window.Close问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,以下行仅适用于部分机器。所有

机器都在运行IE6。 IE SP和OS'各不相同。当它没有
工作时,default.aspx(此代码所在的页面)打开和关闭。

这就是你所看到的。 TSReminder.aspx甚至没有打开。我不确定

这里发生了什么。


Response.Write("< script

language = javascript> window.open(" TSReminder.aspx",null," height = 340,width = 640,status = no,toolbar = no,me nubar = no,location = no")< / script> ;")


Response.Write("< script language = javascript> window.opener =

self< / script>")

Response.Write("< script language = javascript> window.close()< / script>")

For some reason, the below lines only work on select machines. All
machines are running IE6. IE SP''s and OS''s vary. When it doesn''t
work, default.aspx (the page that this code is in) opens and closes.
That''s all you see. TSReminder.aspx doesn''t even open. I''m not sure
what''s going on here.

Response.Write("<script
language=javascript>window.open("TSReminder.aspx", null,"height=340,width=640,status=no,toolbar=no,me nubar=no,location=no")</script>")

Response.Write("<script language=javascript>window.opener =
self</script>")
Response.Write("<script language=javascript>window.close()</script>")

推荐答案

Dave写道:
Dave wrote:

由于某种原因,以下行仅适用于部分机器。所有

机器都在运行IE6。 IE SP和OS'各不相同。当它没有
工作时,default.aspx(此代码所在的页面)打开和关闭。

这就是你所看到的。 TSReminder.aspx甚至没有打开。我不确定

这里发生了什么。


Response.Write("< script

language = javascript> window.open(" TSReminder.aspx",null," height = 340,width = 640,status = no,toolbar = no,me nubar = no,location = no")< / script> ;")


Response.Write("< script language = javascript> window.opener =

self< / script>")

Response.Write("< script language = javascript> window.close()< / script>")
For some reason, the below lines only work on select machines. All
machines are running IE6. IE SP''s and OS''s vary. When it doesn''t
work, default.aspx (the page that this code is in) opens and closes.
That''s all you see. TSReminder.aspx doesn''t even open. I''m not sure
what''s going on here.

Response.Write("<script
language=javascript>window.open("TSReminder.aspx", null,"height=340,width=640,status=no,toolbar=no,me nubar=no,location=no")</script>")

Response.Write("<script language=javascript>window.opener =
self</script>")
Response.Write("<script language=javascript>window.close()</script>")



您的如果您这样做,代码最适合:


将下面的行放在一个字符串中:


---------- -----------------------

函数OpenWin(){var win =

window.open (TSReminder.aspx,null," height = 340,wid th = 640,status = no,toolbar = no,menubar = no,location = no");

窗口。 opener = win;

self.close();

}


window.onload = OpenWin;

--------- ------------------------


在你的PageLoad中

- -------------------------------

Page.RegisterStartupScritps(Me.Type,[StringScript] ,真的)

---------------------------------


我不确定这种脚本是否是开发

web的好习惯,我认为这对用户来说是一个奇怪的行为


:打开一个浏览器窗口:显示另一个窗口:关闭开启窗口


像你这样的一些情况很容易被这块烂摊子烧掉

。带窗口指针。

Your code will fit best if you do:

Put the lines below in a string:

---------------------------------
function OpenWin(){ var win =
window.open("TSReminder.aspx",null,"height=340,wid th=640,status=no,toolbar=no,menubar=no,location=no ");
window.opener = win;
self.close();
}

window.onload = OpenWin;
---------------------------------

In your PageLoad do
---------------------------------
Page.RegisterStartupScritps(Me.Type, [StringScript], True)
---------------------------------

I''m not sure if this kind of script is a good practice in developing
web, I thought that is a weird action to user

:open a browser wndow:shows another one:closes the opener window

Some situations like yours could easily be fired by this piece of mess
up with window pointers.


John,

感谢您的快速回复,但现在我比以前更加迷失。

这就是我对你的指示进行交叉的方式:


< head runat =" server">

< title> Untitled Page< / title>


< script language =" C#" runat =" server">


String scriptString =" function OpenWin()" ;;

scriptString + =" {" ;;

scriptString + =" var win =

window.open(''TSReminder.aspx'',null,''height = 340,wid th = 640,status = no,toolbar = * no,menubar = no,location = n o'');

" ;;

scriptString + =" window.opener = win; " ;;

scriptString + =" self.close(); " ;;

scriptString + ="}" ;;

scriptString + =" window.onload = OpenWin; " ;;


< / SCRIPT>


< / head>


这个只是满是红色波浪形的红线。


你也说:
John,
Thanks for your quick reply, but now I''m even more lost than before.
This is how I interprit your instructions:

<head runat="server">
<title>Untitled Page</title>

<script language="C#" runat="server">

String scriptString = "function OpenWin() ";
scriptString += "{ ";
scriptString += "var win =
window.open(''TSReminder.aspx'',null,''height=340,wid th=640,status=no,toolbar=*no,menubar=no,location=n o'');
";
scriptString += "window.opener = win; ";
scriptString += "self.close(); ";
scriptString += "} ";
scriptString += "window.onload = OpenWin; ";

</SCRIPT>

</head>

This is just full of red squiggly red lines.

You also say:

在你的PageLoad中

---------------------------------

Page.RegisterStartupScritps(我。类型,[StringScript],True)
In your PageLoad do
---------------------------------
Page.RegisterStartupScritps(Me.Type, [StringScript], True)




我假设您要将其添加到:


protected void Page_Load(object sender,EventArgs e)

{


}


我还检查了有关Page.RegisterStartupScrips的帮助,并说它注意:

此方法现已过时。我查了一下,因为它下面还有一条红色的

红色线条。


我真的希望你像昨天一样给我一个快速反应。




John Prado写道:



I''m assuming that you''re refering to add it to:

protected void Page_Load(object sender, EventArgs e)
{

}

I also checked Help about Page.RegisterStartupScrips and it says NOTE:
This method is now obsolete. I checked because it also had a red
squggly red line under it.

I''m really hoping that you give me a quick responce like yesterday.





John Prado wrote:


Dave写道:
Dave wrote:

由于某种原因,以下行仅适用于部分机器。所有

机器都在运行IE6。 IE SP和OS'各不相同。当它没有
工作时,default.aspx(此代码所在的页面)打开和关闭。

这就是你所看到的。 TSReminder.aspx甚至没有打开。我不确定

这里发生了什么。


Response.Write("< script

language = javascript> window.open(" TSReminder.aspx",null," height = 340,width = 640,status = no,toolbar = no,me nubar = no,location = no")< / script> ;")


Response.Write("< script language = javascript> window.opener =

self< / script>")

Response.Write("< script language = javascript> window.close()< / script>")
For some reason, the below lines only work on select machines. All
machines are running IE6. IE SP''s and OS''s vary. When it doesn''t
work, default.aspx (the page that this code is in) opens and closes.
That''s all you see. TSReminder.aspx doesn''t even open. I''m not sure
what''s going on here.

Response.Write("<script
language=javascript>window.open("TSReminder.aspx", null,"height=340,width=640,status=no,toolbar=no,me nubar=no,location=no")</script>")

Response.Write("<script language=javascript>window.opener =
self</script>")
Response.Write("<script language=javascript>window.close()</script>")



您的如果您这样做,代码最适合:


将下面的行放在一个字符串中:


---------- -----------------------

函数OpenWin(){var win =

window.open (TSReminder.aspx,null," height = 340,wid th = 640,status = no,toolbar = no,menubar = no,location = no");

窗口。 opener = win;

self.close();

}


window.onload = OpenWin;

---- -----------------------------


在你的PageLoad中

---------------------------------

Page.RegisterStartupScritps(我。输入,[StringScript],True)

---------------------------------


我不确定这种脚本是否是开发

web的好习惯,我认为对用户来说这是一个奇怪的行为


:打开一个浏览器窗口:显示另一个窗口:关闭开启窗口


像你这样的一些情况很容易被这块乱七八糟的东西解雇带窗口指针的


Your code will fit best if you do:

Put the lines below in a string:

---------------------------------
function OpenWin(){ var win =
window.open("TSReminder.aspx",null,"height=340,wid th=640,status=no,toolbar=no,menubar=no,location=no ");
window.opener = win;
self.close();
}

window.onload = OpenWin;
---------------------------------

In your PageLoad do
---------------------------------
Page.RegisterStartupScritps(Me.Type, [StringScript], True)
---------------------------------

I''m not sure if this kind of script is a good practice in developing
web, I thought that is a weird action to user

:open a browser wndow:shows another one:closes the opener window

Some situations like yours could easily be fired by this piece of mess
up with window pointers.


你检查过弹出窗口拦截器吗?


Dave写道:
Have you checked for popup blockers ?

Dave wrote:

由于某种原因,以下行仅适用于部分机器。所有

机器都在运行IE6。 IE SP和OS'各不相同。当它没有
工作时,default.aspx(此代码所在的页面)打开和关闭。

这就是你所看到的。 TSReminder.aspx甚至没有打开。我不确定

这里发生了什么。


Response.Write("< script

language = javascript> window.open(" TSReminder.aspx",null," height = 340,width = 640,status = no,toolbar = no,me nubar = no,location = no")< / script> ;")


Response.Write("< script language = javascript> window.opener =

self< / script>")

Response.Write("< script language = javascript> window.close()< / script>")
For some reason, the below lines only work on select machines. All
machines are running IE6. IE SP''s and OS''s vary. When it doesn''t
work, default.aspx (the page that this code is in) opens and closes.
That''s all you see. TSReminder.aspx doesn''t even open. I''m not sure
what''s going on here.

Response.Write("<script
language=javascript>window.open("TSReminder.aspx", null,"height=340,width=640,status=no,toolbar=no,me nubar=no,location=no")</script>")

Response.Write("<script language=javascript>window.opener =
self</script>")
Response.Write("<script language=javascript>window.close()</script>")


这篇关于Window.Open / Window.Close问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆