2 Replies - 1582 Views - Last Post: 21 October 2002 - 01:16 AM

#1 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Css, Javascript And Iframe Trouble

Posted 20 October 2002 - 11:54 AM

Ok, so I made an Iframe and there are buttons inside the Iframe that are supposed to change the backgroundcolor and the color of the font of outside the Iframe. How can I do that?
I already tried this:

parent.document.body.style.backgroundColor = "red";
parent.document.*.style.color = "blue";

HELP!!!

Koenie
Is This A Good Question/Topic? 0
  • +

Replies To: Css, Javascript And Iframe Trouble

#2 supernova333  Icon User is offline

  • D.I.C Addict

Reputation: 4
  • View blog
  • Posts: 590
  • Joined: 12-March 02

Re: Css, Javascript And Iframe Trouble

Posted 20 October 2002 - 09:42 PM

I got it to work by changing the body's class, which could be cool because you can also change things like the font at the same time:

The main page:
<html>
<head>
<title>Test Page</title>
<style>
.blue { background-color: blue; color: yellow;}
.red { background-color: red; color: white; }
</style>
</head>

<body bgcolor="#FFFFFF">
iFrame:<br>
<iframe src="iframe.htm" name="define" width="200" marginwidth="0" height="200" marginheight="0" scrolling="auto" frameborder="0">get a newer browser.</iframe>

</body>
</html>


The iFrame page:
<html>
<head>
<title>iFrame</title>
</head>

<body bgcolor="#FFFFFF">
<form>
<input type="button" name="Blue" value="Blue" onclick="parent.document.body.className='blue'">
<input type="button" name="Red" value="Red" onclick="parent.document.body.className='red'">
</form>
</body>
</html>

Was This Post Helpful? 0
  • +
  • -

#3 Koenie  Icon User is offline

  • What?!

Reputation: 0
  • View blog
  • Posts: 1,313
  • Joined: 08-July 02

Re: Css, Javascript And Iframe Trouble

Posted 21 October 2002 - 01:16 AM

Ok, thanks, it's not exactly what I wanted, but now I can figure it all out easily!

Thanks, Koenie
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1