Over a year ago I wrote a post ( Dynamic HTML with JavaScript ) which illustrated some techniques to dynamically add stylesheets and scripts in an HTML page loaded. Who uses prototype.js can greatly simplify your life by using, for example:
1 2 3 4 5 6 | "dom:loaded" , document. observe ("Sun: loaded", function () { new Element ( "script" , { type : "text/javascript" , src : "/js/altro.js" } ) ; var script = new Element ("script", {type: "text / javascript" src "/ js / altro.js"}); ) [ 0 ] . insert ( script ) ; $ $ ("Head") [0]. Insert (script); } ); |
After the page is loaded ( document.observe ) adds a new script JavaScript! For styles that is exactly the same thing!










There are no comments for this post
Leave a comment