Microsoft web programmers need to read a book
Someone at microsoft doesn't know how to write code...
function findDIV(x)
{
var oDiv = document.all.tags("DIV");
var iDiv;
if (oDiv != null)
{
iDiv = oDiv.length;
for (var i=0; i<iDiv; i++)
{
if(oDiv[i].contains(x))
{
return oDiv[i];
}
}
}
}
Can anyone tell me what's wrong with this FUNCTION? (Remember, functions are supposed to return something. What happens if oDiv[i].contains(x) = false?). See, this is why I like compilers because you catch these errors. The error I get is 'function does not always return a value'. So I am assuming it is NOT returning a value in my case.
This specifically caused problems with my browser (Netscape 4.03). It basically was maxing out my cpu and crashing netscape.
The way I see it is that their fancy menu bar calls this function but since my netscape doesn't support divs (i'm assuming, not quite sure though), either oDiv[i].contains(x) returns false OR oDiv = null (obviously otherwise this function would've returned something).
Not sure if this is on topic or not but I hate sloppy code, it's one of my pet peeves.