Sensei: Target bei onclick

Greez!

Bitte um Hilfe:
Wenn ich mit JS einen Link realisiere, und das target angeben will auf selbes Fenster.

Muss es dann

onclick="_self.location = '../main.htm';return false;"
oder
onclick="self.location = '../main.htm';return false;"
oder
noch anders heißen?

Danke für die Hilfe,

Sensei

  1. Hallo Sensei,

    Muss es dann

    onclick="_self.location = '../main.htm';return false;"
    oder
    onclick="self.location = '../main.htm';return false;"
    oder
    noch anders heißen?

    es muß heißen:
    onclick="location.href = '../main.htm';return false;"

    self kannst Du weglassen.

    Grüße
    Andreas

    --

    If you describe things as better than they are, you are considered to be romantic;
    if you describe things as worse than they are, you will be called a realist;
    and if you describe things exactly as they are, you will be thought of as a satirist.
    (Quentin Crisp)
  2. Hallo.

    Wenn ich mit JS einen Link realisiere, und das target angeben will auf selbes Fenster.

    Muss es dann
    [...]
    anders heißen?

    Kann, muss aber nicht. Zu empfehlen wären

    onclick="window.location.href = 'da_hin.html'; return false"

    und

    onclick="self.location.href = 'da_hin.html'; return false",

    aber auch

    onclick="location.href = 'da_hin.html'; return false"

    funktioniert.

    Gruß
    Norbert

    1. Danke, ihr habts mir wirklich sehr weitergeholfen. Manchmal sieht man den Wald vor lauter Bäumen nicht...

      thx alot!