On 03/16/2010 06:28 PM, Dilipkumar Jadhav wrote:
  Hi Sergiu,
 I phrased my question incorrectly. I am required to load CSS files
 conditionally using JS. There is a GPL licensed Nifty Cube library
 that is used for creating round corner effects which I was trying to
 import into my wiki. Here is the code snippet where I am stuck:
---------------------------------------------------------------------------------------------------------------
 var oldonload=window.onload;
 if(typeof(NiftyLoad)!='function') NiftyLoad=function(){};
 if(typeof(oldonload)=='function')
      window.onload=function(){oldonload();AddCss();NiftyLoad()};
 else window.onload=function(){AddCss();NiftyLoad()};
 function AddCss(){
 niftyCss=true;
 var l=CreateEl("link");
 l.setAttribute("type","text/css");
 l.setAttribute("rel","stylesheet"); 
Set the parse option of the JSX object to Yes, then replace the next
line with:
l.setAttribute("href", "$doc.getURL('ssx')");
l.setAttribute("href","niftyCorners.css");
 l.setAttribute("media","screen");
 document.getElementsByTagName("head")[0].appendChild(l);
 } 
--
Sergiu Dumitriu
http://purl.org/net/sergiu/