/ Published in: JavaScript
old stuff floating around my system. trying to get organized. might not be worth keeping. I'll weed it out later
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function setActiveStyleSheet(title) { var i, a, main; // find an loop through all the <link> elements in the document for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) { // disable all the stylesheet if (a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) a.disabled = true; // if it is the stylesheet requested, then enable it if (a.getAttribute("title") == title) a.disabled = false; } } // Jumble addresses function decryptEmail() { for(i=0; i<= document.links.length-1; i++) { var str = new String(document.links[i].href); document.links[i].href = } } var __PNGReplace = "png.gif"; function changePngForIEWin() { imgs = document.getElementsByTagName("img"); for (var i = imgs.length; i-- > 0;) { if(imgs[i].src.indexOf(".png") > 0) { imgs[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=" + imgs[i].src + ",sizingMethod=scale)"; imgs[i].width = imgs[i].width; imgs[i].height = imgs[i].height; imgs[i].src = __PNGReplace; } } } function setCookie(name, value, expires, path, domain, secure) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); } /* Gets the value of the specified cookie. name Name of the cookie to get the value of. Returns a string containing value of specified cookie, or null if cookie does not exist. */ function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } function PreloadImages() { //alert("number of images to load: " + PreloadImages.arguments.length); // var arr = new Array(PreloadImages.arguments.length); for(var c = PreloadImages.arguments.length; c -- > 0;) { _img = new Image(); _img.src = PreloadImages.arguments[c]; } } function setLinkedStyleSheet(title) { var linkNodes = document.getElementsByTagName("link"); for ( i = 0; i < linkNodes.length; i++ ) { linkNode = linkNodes[i]; relAttr = linkNode.getAttribute('rel'); if ( relAttr && ( relAttr.indexOf("style") != -1 ) && linkNode.getAttribute("title") ) { linkNode.disabled = true; if ( linkNode.getAttribute("title") == title ) linkNode.disabled = false; } } } // function for changing stylesheets using document.styleSheets function setStyleSheet(theme) { for ( i = 0; i < document.styleSheets.length; i++ ) { if ( document.styleSheets[i].title ) { document.styleSheets[i].disabled = true; if ( document.styleSheets[i].title == theme ) document.styleSheets[i].disabled = false; } } }