Saturday 19 July 2014

Add dynamic css file name using javascript

You have to add css inside head tab.
Ex: <html><head><link rel='stylesheet' type='text/css' href='mycss.css'></head><div>Welcome...</div></html>

If you want to add mycss.css dynamically in the above html
First assign above html to var
var myHtml="<html><head><link rel='stylesheet' type='text/css' href='mycss.css'></head><div>Welcome...</div></html>";
Find for 'mycss.css' from myHtml then replace using javascript with your file.