SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Removing document.all

    Hi all,

    I'm currently doing a major code clean-up on a big site. Up until now its been very much IE-only focussed, but thats slowly changing, so I've been allowed to convert a lot of the tag-soup code to nice clean(ish) XHTML/CSS.

    However, I'm finding a fair bit of JavaScript thats not exactly cross-browser friendly. Unfortunately, I'm not a JS guru at all, so I could do with some help.

    To start with, I've got one that uses document.all throughout, for example:
    Code:
    eval("document.all.Group" + i + ".style.display='none'");
    which sets the style of a div whose id="Group1" to display: hidden.

    Whats the correct syntax to change this to document.getelementbyid - so it'll work in FireFox ?

    Thanks in advance,


    Olly.
    Olly Hodgson
    thinkdrastic.net

  2. #2
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Code:
     document.getElementById('Group' + i).style.display = 'none';

  3. #3
    Guru Meditation Error gnarly's Avatar
    Join Date
    Dec 2003
    Location
    Cheltenham, United Kingdom
    Posts
    692
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Thanks, you're a star :-)
    Olly Hodgson
    thinkdrastic.net


Bookmarks

Posting Permissions

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