Results 1 to 4 of 4

Thread: Test in JS Function for an invisible field!

  1. #1
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Test in JS Function for an invisible field!

    Sorry

    I rarely use Javascript and decided to play around with a help table which displays field/label related comments.

    In order to save desktop space I have made the comments section so that the user can make the section visible or invisible. Have a problem with the following function when the section is invisible and am struggling to understand(due my complete lack of JS knowledge) how to include a check for the element being invisible!

    Be grateful for any pointers
    Ade


    function showhelp(id){
    document.getElementById("txtHelper").innerHTML = help[id];
    }

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    function checkHelp() {
    return (document.getElementById("txtHelper").innerHTML === "");
    }

    Returns true if the txtHelper is empty.
    Last edited by Twey; 08-08-2005 at 03:02 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    To the OP: I don't recommend your approach at all. Instead, place the comments adjacent to the appropriate sections, and hide them through script. Then, when the user wishes to see more information, reveal those hidden sections. This allows for decent fallback for any and all users.

    See a previous thread for code that could help you achieve this.

    Mike

  4. #4
    Join Date
    Aug 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Twey but I am not quite on the ball today!

    The 'txtHelper' field was/is within the hidden section and looking at the source for the postback isn't on the page.

    How would I modify the code to display the default string (id = "Default") on error?

    Ade

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
  •