Andi: Übergeordnetes DIV ansprechen

Hallo!

ich habe folgendes Problem:
Ich habe ein DIV, in welchem sich ein Link befindet. Dieser sollte Onklick:
this.parent.style.display='none';
...also das DIV unsichtbar machen.
Parent will er aber nicht, und nur this entfernt nur den Link. Was mach ich falsch?

Gruß
Andi

  1. Hi,

    Parent will er aber nicht, und nur this entfernt nur den Link. Was mach ich falsch?

    du arbeitest am DOM-Objekt-Modell vorbei, das für solche Zwecke die parentNode-Eigenschaft vorhält.

    MfG
    Rouven

    --
    -------------------
    Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends: commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for working long hours but are rarely credited with being driven by creative fevers. Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination, but because their imagination reveals worlds that others cannot see. -- Larry OBrien and Bruce Eckel in Thinking in C#
    1. Ja, danke Euch beiden.

      ... war ich halt so von JDOM gewöhnt.

    2. Hallo Rouven.

      […] DOM-Objekt-Modell […]

      Irgendwie doppelt gemoppelt …

      Einen schönen Dienstag noch.

      Gruß, Ashura

      --
      sh:( fo:} ch:? rl:( br: n4:~ ie:{ mo:| va:) de:> zu:} fl:( ss:) ls:[ js:|
      „It is required that HTML be a common language between all platforms. This implies no device-specific markup, or anything which requires control over fonts or colors, for example. This is in keeping with the SGML ideal.“
      [HTML Design Constraints: Logical Markup]
      1. […] DOM-Objekt-Modell […]
        Irgendwie doppelt gemoppelt …

        ehm, yes, da hast du wohl Recht...
        Aber ich sag auch PIN-Nummer, muss eine dauerhafte Beschädigung meines Kernel-Moduls sein - ich werde mal eine Level-5-Diagnose durchführen...

        MfG
        Rouven

        --
        -------------------
        Computer programming is tremendous fun. Like music, it is a skill that derives from an unknown blend of innate talent and constant practice. Like drawing, it can be shaped to a variety of ends: commercial, artistic, and pure entertainment. Programmers have a well-deserved reputation for working long hours but are rarely credited with being driven by creative fevers. Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination, but because their imagination reveals worlds that others cannot see. -- Larry OBrien and Bruce Eckel in Thinking in C#
  2. hi,

    this.parent.style.display='none';
    ...also das DIV unsichtbar machen.
    Parent will er aber nicht, und nur this entfernt nur den Link. Was mach ich falsch?

    Du hast dir eine eigene Syntax zusammenphantasiert, anstatt die korrekte mal nachzuschlagen.

    gruß,
    wahsaga

    --
    /voodoo.css:
    #GeorgeWBush { position:absolute; bottom:-6ft; }