HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 14th, 2000, 04:27 AM
Richard Vos Richard Vos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Netherlands
Posts: 32 Richard Vos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #2  
Old August 14th, 2000, 09:02 AM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 741 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #3  
Old August 14th, 2000, 11:16 AM
Richard Vos Richard Vos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Netherlands
Posts: 32 Richard Vos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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).]

Reply With Quote
  #4  
Old August 15th, 2000, 01:49 PM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 741 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #5  
Old August 18th, 2000, 10:43 AM
Richard Vos Richard Vos is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2000
Location: Netherlands
Posts: 32 Richard Vos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > Onmouseover and on the fly layer-background change


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway