...

View Full Version : Script doesn't work in Netscape - Help



holty
01-19-2003, 01:10 PM
Hi,

I have a problem! I have some script that i haved used before for revealing text or hidden tables etc. It works a treat in IE but fails in Netscape or Mozilla. Can anyone see whats wrong or do you have a better script to reveal text etc?

The code:

<script language="JavaScript1.2">
<!--
var ns6=document.getElementById&&!document.all

function change(e){
if (!document.all&&!ns6)
return
var etarget=ns6?e.target:event.srcElement
var imagetarget=etarget
if (etarget.id=="foldheader"||ns6&&etarget.parentNode.id=="foldheader"){
if (ns6&&etarget.parentNode.id=="foldheader"){
nested=etarget.parentNode.nextSibling.nextSibling
imagetarget=etarget.parentNode
}
else
nested =ns6?etarget.nextSibling.nextSibling:document.all[etarget.sourceIndex+1]
if (nested.style.display=="none") {
nested.style.display=''
}
else {
nested.style.display="none"
}
}

}
document.onclick=change
//-->
</script>

In HTML page:

<div id="foldheader">Click to expand</div>
<div id="foldinglist" style="display:none" style=&{head};>
<div id="foldheader">Hidden Text</div>
</div>

holty
01-23-2003, 09:07 PM
any ideas guys?

anyone got a different 'Reveal' script that will also work in Netscape?

japangreg
01-23-2003, 09:17 PM
Hey, Holty. Not able to go through your script to carefully right now (at work under bosses eye) but I think setting the display property to a blank string only works in IE; try using 'block' instead.



if (nested.style.display=="none") {
nested.style.display='block'
}



hth
japangreg

justame
01-23-2003, 09:17 PM
hol...
just a try® changing this...
<div id="foldheader">Click to expand</div>
<div id="foldinglist" style="display:none" style=&{head};>
<div id="foldheader">Hidden Text</div>
</div>

tooo this...

<div id="foldheader">Click to expand</div>
<div id="foldinglist" style="display:none" style=&{head};></div>
<div id="foldheader">Hidden Text</div>


you sorta had your 'tags' outta nested order n' netscrap doesnt just a like® that...:O(((

just a goodluck® n' hope it helps...:O)))

holty
01-23-2003, 11:01 PM
Cheers mate will try that, i'm sure i had the divs like that b4 and i had probs, so i changed.... will try the block thing and change the divs :)

cheers again :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum