M
mike
The JavaScript below works fine for expandable/collapsible menus in IE,
but Firefox 1.5 complains: "Error: loc.parentNode.nextSibling has no
properties" and highlights the line
foc=loc.parentNode.nextSibling.style?.
Is there a fix to make Firefox happy?
thanks,
Mike
<script type="text/javascript"><!--
function dsp(loc){
if(document.getElementById){
var foc=loc.firstChild;
foc=loc.firstChild.innerHTML?
loc.firstChild:
loc.firstChild.nextSibling;
foc.innerHTML=foc.innerHTML=='+'?'-':'+';
foc=loc.parentNode.nextSibling.style?
loc.parentNode.nextSibling:
loc.parentNode.nextSibling.nextSibling;
foc.style.display=foc.style.display=='block'?'none':'block';}}
if(!document.getElementById)
document.write('<style type="text/css"><!--\n'+
'.dspcont{display:block;}\n'+
'//--></style>');
//--></script>
body HTML looks like this:
<h3><a href="javascript:void(0)" class="dsphead"
onclick="dsp(this)">
<span class="dspchar">+</span>Search</a></h3>
<div class="dspcont">
<ul>
<li><A HREF="http://www.google.com/">Google</A>
<li><A HREF="http://www.yahoo.com/">Yahoo</A>
<li><A HREF="http://www.teoma.com/index.asp">Teoma</A>
</div>
</h3>
but Firefox 1.5 complains: "Error: loc.parentNode.nextSibling has no
properties" and highlights the line
foc=loc.parentNode.nextSibling.style?.
Is there a fix to make Firefox happy?
thanks,
Mike
<script type="text/javascript"><!--
function dsp(loc){
if(document.getElementById){
var foc=loc.firstChild;
foc=loc.firstChild.innerHTML?
loc.firstChild:
loc.firstChild.nextSibling;
foc.innerHTML=foc.innerHTML=='+'?'-':'+';
foc=loc.parentNode.nextSibling.style?
loc.parentNode.nextSibling:
loc.parentNode.nextSibling.nextSibling;
foc.style.display=foc.style.display=='block'?'none':'block';}}
if(!document.getElementById)
document.write('<style type="text/css"><!--\n'+
'.dspcont{display:block;}\n'+
'//--></style>');
//--></script>
body HTML looks like this:
<h3><a href="javascript:void(0)" class="dsphead"
onclick="dsp(this)">
<span class="dspchar">+</span>Search</a></h3>
<div class="dspcont">
<ul>
<li><A HREF="http://www.google.com/">Google</A>
<li><A HREF="http://www.yahoo.com/">Yahoo</A>
<li><A HREF="http://www.teoma.com/index.asp">Teoma</A>
</div>
</h3>