View Full Version : Javascript: changing background color...
blah-de-blah
August 7th, 2003, 10:42 AM
Ok so this is what i have to create (its from a tutorial) :)
http://hotwired.lycos.com/webmonkey/98/03/homework3a/homework.html
But i can't seem to get it to work? I tried view source but it doesn't tell me the source for the other pages, only for the main page which holds all the sub-pages.
I have tried:
<a href="#" onClick="top.frame2.document.body.bgcolor='red';">Red</a>
Shouldn't that do the job for changing the background color to red? thanks!!
norie
August 7th, 2003, 11:53 AM
<A href="#" onclick="document.body.style.backgroundColor = '#ff0000';">red</a>
unless you want the page to automatically scroll back to the top i'd use 'javascript: void(0);' instead of '#'
btw for things like this i'd check msdn first: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods.asp
blah-de-blah
August 7th, 2003, 12:09 PM
oh ok thanks, because the tutorial told me to do "#", but i have no clue what it does :P Btw, don't i need to target the frame i want the color to change in? so would it be:
frame2.document.body....
thanks!
norie
August 7th, 2003, 02:11 PM
Originally posted by blah-de-blah
oh ok thanks, because the tutorial told me to do "#", but i have no clue what it does :P Btw, don't i need to target the frame i want the color to change in? so would it be:
frame2.document.body....
thanks!
I'm pretty sure that's the notation,
and btw in the previous post it says 'about', but it's supposed to say: javascript
blah-de-blah
August 8th, 2003, 12:22 AM
ah yea its working, i just hadta add top.frame2 to the code, so i could target another frame. Thanks!
DigitalPimp
August 8th, 2003, 12:26 PM
If you want the source then just right-click on the area where u think the frame is and say view source.
blah-de-blah
August 8th, 2003, 12:28 PM
ahh thats how you do it, thx for the tip ;)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.