|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi I am trying to change the background of a layer using an onmouseover-event. But why is the following not working? (Besides why are there both a 'background-color' and a 'layer-background-color?)
function changebground(layername) { document.all[layername].style['background-color'] = "#000000"; document.all[layername].style['layer-background-color'] = "#000000"; } Thanks, Richard |
|
#2
|
||||
|
||||
|
function changeBc(obj,col){
document.all?document.all[obj].style:document.layers[obj]; if(document.all) div.backgroundColor=col; else if(document.layers) div.bgColor=col; } This is cross browser and accepts the object(div/layer) name and colour ie: onmouseover="changeBC('divname','black')" when setting the background colour in a style sheet you need to use background-color:#(ie); layer-background-color:#(netscape); or is it the otherway round?? I forget! ------------------ Simon Wheeler FirePages -DHTML/PHP/MySQL |
|
#3
|
|||
|
|||
|
Thanks a lot for replying.
Probably it must be: document.all ? obj = document.all[obj].style : obj = document.layers[obj]; if(document.all) obj.backgroundColor = col; else if(document.layers) obj.bgColor = col; doesn't it? [This message has been edited by Richard Vos (edited August 14, 2000).] |
|
#4
|
||||
|
||||
|
Sorry Richard I missed a bit out !!!!
function changeBc(obj,col){ div=document.all?document.all[obj].style:document.layers[obj]; if(document.all) div.backgroundColor=col; else if(document.layers) div.bgColor=col; } don't remember having had a drink ? then again! ------------------ Simon Wheeler FirePages -DHTML/PHP/MySQL |
|
#5
|
|||
|
|||
|
hello again Simon,
I am sitting here with my head in my hands: I made a few layers. One layer is called (made visible) using the other. The one called is with a bit overlap positioned above the caller. I want to change the background of the one that is called using an onmouseover event. I can't get it done. When the pointer leaves the caller to go above the called one the properties do not change (I'm using the same function above, called with another ID.) Do you have any clues? (And I thought, can't be too difficult... ) Anyway, thanks, Richard Oh, I forgot. Could it have to do with DOM? Maybe the div thinks that the called one is an object of itself? [This message has been edited by Richard Vos (edited August 18, 2000).] |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Onmouseover and on the fly layer-background change |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|