Charles Wyke-Smith
"Stylin' with CSS: A Designer's Guide 2nd Edition"
js ?¬? le so that it can be
located somewhere other than in the same folder as the XHTML page, and
can be referenced by multiple pages. All I did was modify one function in
this ?¬? le from this
function AddCss(){
niftyCss=true;
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href","niftyCorners.css");
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}
to this
function AddCss(path){
niftyCss=true;
var l=CreateEl("link");
l.setAttribute("type","text/css");
l.setAttribute("rel","stylesheet");
l.setAttribute("href",path);
l.setAttribute("media","screen");
document.getElementsByTagName("head")[0].appendChild(l);
}
Now I can pass the relative path to the ?¬? le from each XHTML page, as you
can see from the three-column rounded-corners code. If you use the Nifty
Corners version in the Stylib library, the above change is already made, but if
you download a new version from the Nifty Cube site at http://www.html.it/
articoli/niftycube/index.html, you will need to make these changes to make
it work with the Stylib ?¬? les.
For this example, I am using the three-column ?¬? xed-width layout
we saw earlier, with the following changes (Figure 5.16).
STYLIN??™ WITH CSS - CHAPTER 5 166
The NiftyCorners JavaScript ?¬? le needs to be linked from the head of
the page like this