Hi,
I have a function that is mean to alter the font-size:
// change the font size of the document
function changeSize(fontSize) {
var sheets = document.styleSheets; // Array of all stylesheets
for(var i=0; i < sheets.length; i++) { // For each stylesheet
var sheet = sheets[i];
// alert( sheets[i].title );
if(sheet.title == 'textSize') { // find the one called 'textSize'
// alert( "hello!" );
var rules = sheet.cssRules || sheet.rules; // Array of rules
var rule = rules[0]; // The first rule
// Should only be one rule, and it should be a one line font-size declaration
if(rules.length == 1 && rule.selectorText.match(/body/i) && rule.style.fontSize) {
rule.style.fontSize = fontSize;
return true;
}
else return false; // This is a bad stylesheet, return false
}
}
return false; // Haven't found the stylesheet - return false
}
This works if the stylesheet it looks for is in the same directory as the page the function is located in but if it is in a separate directory - e.g. ../js/js.js instead of ./js.js - it throws the following error:
Security error" code: "1000
Any idea how I resolve this? I don't know much about javascript and I'm hoping it's not a case of simply "NOT ALLOWED" but if so what are the sensible alternatives?
Thanks