I am trying to get the following script to work on my site however I would like to have the Javascript part or even the whole script to be put into a .js file. However when I tried to do so half of my page got cut off and just got a bunch of errors. What may be the problem?
Thanks.
[code=php]<a href=”/index.html”>Home</a> | <a href=”/C/index.html” onMouseover=”showit(0)”>Example</a><br>
<ilayer width=400 height=32 name=”dep1″ bgColor=”#FFFFFF”>
<layer name=”dep2″ width=400 height=32>
</layer>
</ilayer>
<div id=”describe” style=”background-color:#FFFFFF;width:400px;height:32px” onMouseover=”clear_delayhide()” onMouseout=”resetit(event)”></div>
<script type=”text/javascript” language=”javascript1.2″>
var submenu=new Array()
submenu[0]='<font size=”2″ face=”Verdana”><b><a href=”/1.html”>1</a> | <a href=”2.html”>2</a> | <a href=”3.html”>3</a> | <a href=”4.html”>4</a> | <a href=”5.html”>5</a></b></font>’
var delay_hide=500
var menuobj=document.getElementById? document.getElementById(“describe”) : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : “”
function showit(which){
clear_delayhide()
thecontent=(which==-1)? “” : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}
function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout(“showit(-1)”,delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout(“showit(-1)”,delay_hide)
}
function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
</script>