Reputation: 151
function expand(entity) {
var oImage
oImage = entity.childNodes(0).all["image"]
oImage.src = entity.imageOpen
if (typeof(entity.imageOpen) == "undefined")
oImage.src = "<%=request.getContextPath()%>/images/MinusSignBlackSilver.gif";
for(i=0; i < entity.childNodes.length; i++) {
if(entity.childNodes(i).tagName == "DIV") {
entity.childNodes(i).style.display = "block"
}
}
entity.open = "true"
}
is working fine on IE. But in Mozilla gives error entity.childNodes is not a function. What is the right syntax to work properly in IE and Mozilla?
Upvotes: 0
Views: 644
Reputation: 12711
childNodes
is an Array-like object. Try entity.childNodes[0]
instead of (0)
.
Moreover .all
is IE-specific function and is not a part of the specification. You should replace it with either querySelectorAll
or other (backward-compatible) function.
Reference: https://developer.mozilla.org/pl/docs/DOM/element.childNodes
Upvotes: 1