Posts Tagged ‘insert css dynamically’
Insert JavaScript & CSS Dynamically
October 25, 2010
Leave a comment
Below is the code for Adding Javascript:
var headID = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = 'http://www.somedomain.com/somescript.js'; headID.appendChild(newScript);
Below is the code for Adding CSS:
var headID = document.getElementsByTagName("head")[0]; var cssNode = document.createElement('link'); cssNode.type = 'text/css'; cssNode.rel = 'stylesheet'; cssNode.href = 'FireFox.css'; cssNode.media = 'screen'; headID.appendChild(cssNode);
For More Details Refer:
Recent Comments