Monday, August 17, 2009

How to add a CSS Link programmatically using JavaScript

In one of my earlier posts, I demonstrated how to Programmatically Retrieve StyleSheet Url’s Referenced in your Page using JavaScript. In this post, here’s a piece of JavaScript code that demonstrates how you can programmatically reference a CSS link on a page.




title="Float layout" type="text/css" />










The code shown above creates a link element(with properties) and appends it as a child to the <head> section. You can use this technique to let users choose styles and change the appearance of the page.

No comments:

Post a Comment