Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 28 people (57%) answered Yes
Recently 3 of 10 people (30%) answered Yes

Entry

How do I change the bgColor of a layer in another frame with an onClick event?

Apr 4th, 2008 20:52
ha mo, Jean-Bernard Valentaten, Colin Fraser, Peter Lissenko,


> For starters you may want to have a closer look at the documentation 
> section on the front page of this language. Closer examination will 
> reveal most of the answers to you questions, however, it is also a 
> matter of looking att he jargon used, because a lot of easy answers 
> are couched in terms that are difficult to follow. 
> In a more direct response try: 
> function colorchange() {
>      parent.otherframe.document.bgColor = "red"
> }
Almost the answer *g*
Oviousely the question was how to change the bgcolor of a layer, so try 
this instead:
function colorchange() {
  parent.otherframe.document.layers
['theLayerUWantToChange'].document.bgColor = 'anyColorUWant';
}
> where otherframe.document represents the frame's document you want to 
> change the colour of. (Obviously you change the document, not the 
> frame)
> In the page try:
> <a href="javascript:void" onClick="colorchange()">Change</a>
> Good luck.
HTH
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com