By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,608 Members | 1,940 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,608 IT Pros & Developers. It's quick & easy.

set bgcolor in window.open or document.write or...

P: n/a
Nat
Hi I have following code:
-----------------
protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.Write("<span class='tooltipiconouter'><img title =
'"+this.helpString+"' class='tooltipIconInner' align='center' src =
'../Lib/images/questionmark.gif' a href='#' onclick = 'myWin =
window.open(\"\", \"\", \"width=300, height=200, directories=no\");
myWin.document.write(\"" +helpString+"\");'></a></span>");
}
}
-----------------

Now I want to change the bgcolor in the window that opens, what and
where do I have to write that?

I've tried myWin.document.bgcolor=#333333 but either it doesn't work,
or it is because i'm writting it in a wrong place.

Please help

Nat
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <da**************************@posting.google.com >,
nm@sondagsavisen.dk (Nat) wrote:
Hi I have following code:
-----------------
protected override void Render(HtmlTextWriter w)
{
if (helpString!=null)
{
w.Write("<span class='tooltipiconouter'><img title =
'"+this.helpString+"' class='tooltipIconInner' align='center' src =
'../Lib/images/questionmark.gif' a href='#' onclick = 'myWin =
window.open(\"\", \"\", \"width=300, height=200, directories=no\");
myWin.document.write(\"" +helpString+"\");'></a></span>");
}
}
-----------------

Now I want to change the bgcolor in the window that opens, what and
where do I have to write that?

I've tried myWin.document.bgcolor=#333333 but either it doesn't work,
or it is because i'm writting it in a wrong place.

Please help

Nat


As an alternative, just set the body tag background color. When you
write out the tags to the window.open document write out the normal html
tags like:

var debugWindowName = "My Window";
var newWindow;

newWindow = newWindow = window.open(
"",debugWindowName,"scrollbars=yes,resizable=yes,w idth=700,height=500");
newWindow.document.writeln(
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">');
newWindow.document.writeln("<html>");
newWindow.document.writeln(
"<header><title>Window " + debugWindowName + "</title></header>");
newWindow.document.writeln(
"<body bgcolor="red">");

Robert
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.