• [^] # Re: Fanatique ?

    Posté par . En réponse au journal Defi pour la terre. Évalué à 1.

    Je peux valider le formulaire (il ne faut pas cliquer sur l'image mais appuier sur ) et le test se passe correctement.

    Ca delire dans cette fonction javascript:

    function MM_validateForm() { //v4.0
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
    if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
    if (p<1 || p==(val.length-1)) errors+='- '+nm+' doit ́tre une adresse email valide.\n';
    } else if (test!='R') { num = parseFloat(val);
    if (isNaN(val)) errors+='- '+nm+' doit tre un chiffre.\n';
    if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
    min=test.substring(8,p); max=test.substring(p+1);
    if (num<min || max<num) errors+='- '+nm+' le num ́ro sp ́cifi ́ est incorrect.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- Tu dois indiquer ton '+nm+ '.\n'; }
    } if (errors) alert('Attention,\n'+errors);
    document.MM_returnValue = (errors == '');


    Avertissement javascript de firefox:
    Avertissement : deprecated arguments usage
    Fichier Source : http://www.defipourlaterre.org/juniors/formVerification2.js(...)
    Ligne : 11
    Avertissement : assignment to undeclared variable val
    Fichier Source : http://www.defipourlaterre.org/juniors/formVerification2.js(...)
    Ligne : 12

    Firefox 1.0 (ubuntu) avec Dom Inspector & Web Developer & Adblock & Linkification.