In .NET 2.0:
protected void Page_Load(object sender, EventArgs e)
{
Page.ClientScript.RegisterStartupScritp(...)
}
Dave wrote:
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,width=640,status=no,toolbar=no,menubar=no,location=no');
";
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:
In your PageLoad do
---------------------------------
Page.RegisterStartupScritps(Me.Type, [StringScript], True)
I'm assuming that you're refering to add it to:
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 wrote:
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,menubar=no,location=no")</script>")
Response.Write("<script language=javascript>window.opener =
self</script>")
Response.Write("<script language=javascript>window.close()</script>")
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,width=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
pen 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.