PDA

View Full Version : Problem with script when returning from ajax



tempfire
06-05-2008, 08:40 PM
Hi all... I post this here because the DD forums have been so helpful to me so far.

My problem is this. I am using DD DHTML Window widgets with great success in a large application for my company. Using the following script I create dynamic drop down menus. If I return all my windows as IFrames all works well, but that is not feasible due to internal factors. So I converted all of my windows to the "ajax" type. I'm asking this here because the problem isn't with the DHTML Window Widget, but rather Internet Explorer handling this javascript when its being returned from ajax. Firefox handles it absolutely fine. Can anyone advise how to get IE to use this script properly?

The script I'm referencing below is included in the page via this line in the head section



<script type="text/javascript" src="nav.js"></script>


And here are the contents of nav.js



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);



The error I'm getting is this ...

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


Again, thanks in advance for your advice and help!

molendijk
06-08-2008, 10:16 AM
What is happening in IE when you leave out the 'document':

var sfEls = getElementById("nav").getElementsByTagName("LI");?
---
Arie Molendijk.