Hello everybody,
I'm trying to build a page that can be manipulated by any user through
CSS. The user can then store his layout in a database, so it can be
presented on the web. Therefore I'm trying to build a function that
will output the complete CSS to a database.
Here's my code:
var isIE = (navigator.appName == "Microsoft Internet Explorer");
var isNS = (navigator.appName == "Netscape");
// Genereert output voor opslag in database
function generateCSS() {
var output = '';
var sheet = parent.app.document.styleSheets[0];
var ssRules = sheet.cssRules || sheet.rules;
for(i = 0; i < ssRules.length; i++) {
output += ssRules[i].selectorText + ' {';
for(var item in ssRules[i].style) {
if(isIE && ssRules[i].style.getAttribute(item)) {
output += '\n ' + item + ':';
output += ssRules[i].style.getAttribute(item) + ';';
} else if (isNS) {
output += 'what the hell shoud I put here!?';
}
}
output += '\n}\n\n';
}
alert(output);
}
Though this works pretty cool in IExplorer, I can't seem to get this
working with Mozilla. Can anyone help me on this one?!? I've been
studying these forums for hours now, and can't seem to come up with a
decent working solution.
Thnx in advance for any kind of attention to this... :-)