I have an expandable data tree that works in IE6 and 7, but in IE8 and Firefox, the rows will not expand. Debugging tells me that in line foldercontent.style.display="", style is a null object. Can this work in IE8 or should I used another script? Thank you for you help.
Code:
var head="display:''"
img1=new Image()
img1.src="<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/plus.gif") %>"
img2=new Image()
img2.src="<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/minus.gif") %>"
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}
if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/minus.gif") %>)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/plus.gif") %>)"
}
}
}
if (ie4||ns6)
document.onclick=checkcontained
Code:
var head="display:''"
img1=new Image()
img1.src="<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/plus.gif") %>"
img2=new Image()
img2.src="<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/minus.gif") %>"
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
function checkcontained(e){
var iscontained=0
cur=ns6? e.target : event.srcElement
i=0
if (cur.id=="foldheader")
iscontained=1
else
while (ns6&&cur.parentNode||(ie4&&cur.parentElement)){
if (cur.id=="foldheader"||cur.id=="foldinglist"){
iscontained=(cur.id=="foldheader")? 1 : 0
break
}
cur=ns6? cur.parentNode : cur.parentElement
}
if (iscontained){
var foldercontent=ns6? cur.nextSibling.nextSibling : cur.all.tags("UL")[0]
if (foldercontent.style.display=="none"){
foldercontent.style.display=""
cur.style.listStyleImage="url(<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/minus.gif") %>)"
}
else{
foldercontent.style.display="none"
cur.style.listStyleImage="url(<%= renderResponse.encodeURL(renderRequest.getContextPath() + "/images/plus.gif") %>)"
}
}
}
if (ie4||ns6)
document.onclick=checkcontained