SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    May 2007
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    whichDog.style "undefined" problem

    Here's my code:

    isIE=document.all;
    isNN=!document.all&&document.getElementById;
    isN4=document.layers;
    whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");
    if (isIE||isNN) whichDog.style.visibility="hidden";
    else if (isN4) document.theLayer.visibility="hide";

    setting style to hidden gives whichDog.style is "undefined" error. Using alerts i found out that whichDog object is getting set but whichDog.style object is not getting set.

    How can i set whichDog.style object?

    Thanks.
    anubhatia@yahoo.com

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This should be in the javascript forum.

    There is no need to bother with detecting IE4 or NS4. IE5.5 and above support document.getElementById, so just use that. The problem is most likely because you are running this javascript before the page has loaded. How is this being done? Via an onclick in some HTML element?

  3. #3
    The Mind's I ® silver trophy Dark Tranquility's Avatar
    Join Date
    Sep 2003
    Location
    KSA - UAE
    Posts
    9,458
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Moved to the Javascript forum
    Welcome to SP
    Can you show us your full code? both HTML and JS?
    Also as Raffles said almost everyone had dropped supporting old archaic browser like Netscape4 and IE4 since few years now! so no need to bother yourself with detecting and supporting them


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
  •