Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script doesn't work in Netscape - Help

    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>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts
    any ideas guys?

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

  • #3
    New Coder
    Join Date
    Sep 2002
    Location
    Washington, DC
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    Code:
    if (nested.style.display=="none") { 
    nested.style.display='block' 
    }
    hth
    japangreg
    Last edited by japangreg; 01-23-2003 at 09:19 PM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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)))

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •