Click to See Complete Forum and Search --> : external style sheets not working...


696020
11-30-2003, 02:50 PM
Hi,

I am trying to get this script to work in an external .js file.

See below:

<script type="text/javascript">
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;
</script>

pyro
11-30-2003, 02:53 PM
<script type="text/javascript" src="script.js"></script>

and, remember that the <script> and </script> tags do not go in the external file.

696020
11-30-2003, 02:56 PM
brilliant...
it works!
thanks.

pyro
11-30-2003, 03:03 PM
You're welcome... :)