Skip to content

Instantly share code, notes, and snippets.

@quoidautre
Created April 5, 2012 07:36
Show Gist options
  • Save quoidautre/2308786 to your computer and use it in GitHub Desktop.
Save quoidautre/2308786 to your computer and use it in GitHub Desktop.
JS: Add dynamic css file
function adddynamiccssfile(filename) {
if (filename != "") {
var headID = document.getElementsByTagName("head")[0];
var cssNode = document.createElement('link');
cssNode.type = 'text/css';
cssNode.rel = 'stylesheet';
cssNode.href = filename;
cssNode.media = 'screen';
headID.appendChild(cssNode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment