...

View Full Version : short script throws error plz advise.



bazz
10-15-2005, 04:45 PM
Hello folks,

Its a while since I have been in here asking for your help but I am stumped with this especially because it is used only to make IE perform and it is oly that browser which throws up the error. :rolleyes:



<script type="text/javascript"><!--//--><![CDATA[//><!--

sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]></script>



this is the error I am shown by IE6win

error: 'document.getElementById(...) ' is null or not an object

Any tips appreciated

Bazz

_Aerospace_Eng_
10-15-2005, 05:16 PM
I'm guessing you are trying to make IE use li:hover, read this article (http://www.alistapart.com/articles/horizdropdowns). They already have a script that does this quite well.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum