469,352 Members | 1,694 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

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

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
1 4817
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.

Similar topics

2 posts views Thread by Jawahar Rajan | last post: by
9 posts views Thread by Justin Koivisto | last post: by
2 posts views Thread by dan | last post: by
4 posts views Thread by Phillip Parr | last post: by
6 posts views Thread by news.versatel.de | last post: by
10 posts views Thread by soup_or_power | last post: by
1 post views Thread by Angelos | last post: by
2 posts views Thread by jackson2005 | last post: by
3 posts views Thread by kosmodisk | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.