Learn free online HTML5, javascript, and jquery Tutorials by Examples

Wednesday, 14 January 2015

Embedding extra styles with noscript(Javascript)

<script>
document.write("<link href='css/css.css' rel='styleSheet' type='text/css' />");

------------------------------Another way----------------------------------

var l=document.createElementNS("http://www.w3.org/1999/xhtml","link");
    l.setAttribute("rel", "stylesheet");
    l.setAttribute("type", "text/css");
    l.setAttribute("href", "/css/style-js.css");
    document.getElementsByTagName("head")[0].appendChild(l);

</script>

No comments:

Post a Comment