I'm using a script that with this code:
Code:
window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}
But then learned that window.onunload doesn't work for Chrome and Opera. Now I figured I could bake this part of the code into another function I have that looks like this:
Code:
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
But I'm quite new to javascripts and I'm not really sure on how to make it work and I would like some help on how the two functions could be done together.