location.href

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • location.href

    Hi, ich kann mir nicht erklären warum es nicht funktioniert ich will in eine funktion ein
    location.href einbauen... ala

    function soundso {
    if (age==18) {
    location.href = "deutsch/start.htm";
    }
    }

    hab schon alles probiert, aber das funkz nicht, warum? hab es mit top.location, window.location probiert... wo liegt der fehler?

  • #2
    wie wird die Funktion aufgerufen und wo kommt age her ?!

    Kommentar


    • #3
      http://selfhtml.teamone.de/javascrip...e/location.htm

      Kommentar


      • #4
        PHP-Code:
        <script language="JavaScript" type="text/JavaScript">
        <!--

        function 
        MM_swapImgRestore() { //v3.0
          
        var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
        }

        function 
        CalculateAge(yearmonthday) {

          if (
        year == || month == || day == 0)
            return 
        "";
          
          var 
        birthday = new Date(yearmonth 1day);
          var 
        today    = new Date();
          
          var 
        age today.getFullYear() - birthday.getFullYear();


          if (
        today.getMonth() < birthday.getMonth())
            
        age age 1;
          else {

            if (
        today.getMonth() == birthday.getMonth() &&
            
        today.getDate() < birthday.getDate())
              
        age age 1;
          }
          
        // return age;
          
                  
        if (age >= 18) {
                
        //return true;
                
                
        document.location.href='deutsch/start.htm';
                    

                  } else {
                
        alert("Da Sie noch keine 18 Jahre alt sind dürfen Sie diese Seite nicht betreten.");
                
        document.location.href='deutsch/start.htm';
                }

        Zuletzt geändert von LordCash; 03.03.2004, 13:55.

        Kommentar


        • #5
          ob in age zum zeitpunkt der abfrage das drin steht, was du erwartest, hast du selbstverständlich bereits überprüft (z.b. kontrollausgabe per alert) ...?
          I don't believe in rebirth. Actually, I never did in my whole lives.

          Kommentar


          • #6
            ja das script lief einwandfrei, hab ich überprüft, ich weiß jetzt woran es lag, es war ein reines Mac IE und Safari Problem, das lag daran das er die onclick funktion nicht richtig erkannte...

            Kommentar

            Lädt...
            X