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 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2002
    Location
    51° 03' -78" N -114° 05' 72" W
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is it possible to shorten this script at all

    I have made a script that is cross browser compatable but I was wondering if there was any way of shortening it more then I already have if not please let me know also

    function HideShow(){
    //if(!ns && !ie && !w3) return; needed for netscape? dont know why
    if(!ns && !ie && !w3) return;

    AObj=eval(doc + 'A' + sty);AObj.visibility ="hidden";
    BObj=eval(doc + 'B' + sty);BObj.visibility ="hidden";
    CObj=eval(doc + 'C' + sty);CObj.visibility ="hidden";
    DObj=eval(doc + 'D' + sty);DObj.visibility ="hidden";
    EObj=eval(doc + 'E' + sty);EObj.visibility ="hidden";
    FObj=eval(doc + 'F' + sty);FObj.visibility ="hidden";
    GObj=eval(doc + 'G' + sty);GObj.visibility ="hidden";
    HObj=eval(doc + 'H' + sty);HObj.visibility ="hidden";
    IObj=eval(doc + 'I' + sty);IObj.visibility ="hidden";
    JObj=eval(doc + 'J' + sty);JObj.visibility ="hidden";
    KObj=eval(doc + 'K' + sty);KObj.visibility ="hidden";
    LObj=eval(doc + 'L' + sty);LObj.visibility ="hidden";
    MObj=eval(doc + 'M' + sty);MObj.visibility ="hidden";
    NObj=eval(doc + 'N' + sty);NObj.visibility ="hidden";
    OObj=eval(doc + 'O' + sty);OObj.visibility ="hidden";
    PObj=eval(doc + 'P' + sty);PObj.visibility ="hidden";
    QObj=eval(doc + 'Q' + sty);QObj.visibility ="hidden";
    RObj=eval(doc + 'R' + sty);RObj.visibility ="hidden";
    SObj=eval(doc + 'S' + sty);SObj.visibility ="hidden";
    TObj=eval(doc + 'T' + sty);TObj.visibility ="hidden";
    UObj=eval(doc + 'U' + sty);UObj.visibility ="hidden";
    VObj=eval(doc + 'V' + sty);VObj.visibility ="hidden";
    WObj=eval(doc + 'W' + sty);WObj.visibility ="hidden";
    XObj=eval(doc + 'X' + sty);XObj.visibility ="hidden";
    YObj=eval(doc + 'Y' + sty);YObj.visibility ="hidden";
    ZObj=eval(doc + 'Z' + sty);ZObj.visibility ="hidden";
    }

    onload=HideShow ;
    //End-->
    and of course the link and div tags to be equivilent to above like the one example like below

    <a href="#" onMouseover="Javascript:HideShow();AObj.visibility='visible';">A</a>

    <div id="A" style="position:absolute;visibility:hidden">A</div>

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    function HideShow()
    {
    if(!ns && !ie && !w3) return;
    for (t=65;t<91;t++)
    {eval(doc + String.fromCharCode(t) + sty+'.visibility ="hidden"');}
    }
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not using eval
    Code:
    function HideShow() 
    { 
        if(!ns && !ie && !w3) return; 
        for (t=65;t<91;t++) 
        {
            document.getElementById( String.fromCharCode( t ) ).style.visibility = 'hidden';
        } 
    }
    All the text in this post that is bold red has been brought to you by: Borgtex and the letter i
    Last edited by beetle; 01-21-2003 at 01:54 AM.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #4
    Regular Coder
    Join Date
    Aug 2002
    Location
    Spain
    Posts
    420
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hummm... somebody has a visibility problem, beetle (visbility)
    Don't resist to assimilation. Billions of Borgs can't be wrong!

  • #5
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by Borgtex
    hummm... somebody has a visibility problem, beetle (visbility)
    Hehe, ooops.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOL... don't you love typos? I've made some really funny ones.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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