style.setProperty()

A

adamF

Hi,

I'm using the following code to edit a style sheet when a page loads
with an onload function. When the code is run locally in Mozilla on a
PC and MAC everything is fine, however when running from a server the
code dose not execute on either platform? Any ideas...

Thanks

function reset() {
if (navigator.userAgent.indexOf("Mozilla") != -1) {
function splitBrowsers() {
if (document.styleSheets[0].cssRules)
return document.styleSheets[0].cssRules;
else
return document.styleSheets[0].rules;
}
function remProp() {
var rule = splitBrowsers();
rule[1].style.removeProperty('background-image');
}
function setPropVal() {
var rule = splitBrowsers();
rule[0].style.setProperty('background-color','white',null);
rule[0].style.setProperty('background-image','url(../i/std/contentTop.gif)',null);
rule[0].style.setProperty('background-position','top
center',null);
rule[0].style.setProperty('background-repeat','no-repeat',null);
rule[2].style.setProperty('margin-top','3px',null);
rule[1].style.setProperty('margin-top','-4px',null);
}
remProp();
setPropVal();
}
else { }
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top