Java Script

Giarc86

Expert Member
Joined
May 28, 2008
Messages
1,243
Reaction score
4
I have a main window and when i select a colour, say red green or blue from a drop down list and then click a button or link, a new set size window must open and the selected colour must be the bg color of the new secondary window. I have gotten everything to work except the bg color.

Can anyone shed some light? :)

Thanks
 
Eesh. Your options are few and far between.

On opening the new window, you need to set the bgcolor/style of the body element. Best way to do this IMO is by changing the style class, and having a few classes in your CSS that have the relevant background-color set. This is relatively easy to do, esp. using the various js frameworks available (jQuery, etc.)

Alternatively (not recommended), write the HTML using Javascript.
 
like this

Code:
<html>
<script>
function test()
{
	my_window = window.open ("","mywindow1","status=1,width=350,height=150"); 
	[COLOR="Red"]my_window.document.bgColor="FFFFCC"; [/COLOR]

}
</script>
<body onload="test()"> 
</body>
</html>
 
like this

Code:
<html>
<script>
function test()
{
	my_window = window.open ("","mywindow1","status=1,width=350,height=150"); 
	[COLOR="Red"]my_window.document.bgColor="FFFFCC"; [/COLOR]

}
</script>
<body onload="test()"> 
</body>
</html>
That's so old school, Necuno. :p

But ja, something like that.
 
That's so old school, Necuno. :p

But ja, something like that.

well you don't have to use it as a set color ("FFFFCC"), obviously the function can except a parameter and from there set the bgc.

and
On opening the new window, you need to set the bgcolor/style of the body element
was satisfied, since we don't know exactly what PseudZ is going to use it for apart from popping windows with different bgc's...

That's so old school, Necuno. :p
But ja, something like that.
whatever :p, sometimes oldschool is better :)
 
Last edited:
Good points. You've answered the OP question too. :)

I'm still trying to lose the old way of coding, and get into the "new" way - seperate style from content, etc. Can be frustrating at times.
 
I'm still trying to lose the old way of coding, and get into the "new" way - seperate style from content, etc. Can be frustrating at times.

tell me about :)

it gets worse when you have to maintain an application thats in another language and you know what it suppose to do and how to write it, but the syntax and implementation differs :D
 
tell me about :)

it gets worse when you have to maintain an application thats in another language and you know what it suppose to do and how to write it, but the syntax and implementation differs :D
Agreed. :) I've taken over a web app that is riddled with tables. It pains me to do it, really.
 
Top
Sign up to the MyBroadband newsletter
X