Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safari and setting backgroundcolor with javascript

Status
Not open for further replies.

RicksAtWork

Programmer
Joined
Nov 1, 2005
Messages
120
Location
GB
var obj = document.getElementById("div1");

obj.style.backgroundColor = "#FF0000";

This works in al browsers except Safari 1.3.2

Any ideas how to resolve this?
 
I've never heard of that not working in safari before, however I don't have a mac to prove or disprove that notion (I did not find anything about it from a google search, however)

However, there are alternatives to changing background colors:
Code:
<style type="text/css">
.bg {
   background-color:#ff0000;
}
</style>
<script type="text/javascript">
var obj = document.getElementById("div1");
obj.className = "bg"
</script>

-kaht

How much you wanna make a bet I can throw a football over them mountains?
sheepico.jpg
 
its for a yellow fad type technique - so I cant add all the iterations of this to the css!

 
The code you gave works fine - it may be that you're fading too fast for Safari to update all the iterations. try slowing down your fade delay.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top