Date: 11/30/06 (Javascript Community) Keywords: no keywords Any advice towards this would be most appreciated! function Login(){ var done=0; var testV = 1; var tokencode=document.login.tokencode.value; var keycode=document.login.keycode.value; while(testV<4){ alert(testV); if (tokencode=="225957" && keycode=="138632") { done=1; } if (tokencode=="875528" && keycode=="135925") { done=2; } if (done==0) { testV+=1;} if (done==1) { window.location="try_5.html";} if (done==2) { window.location="try_4.html";} if (testV==4) {window.location="try_3.html";} } } The goal: If someone enters a wrong/blank "tokencode" and "keycode", they get 2 chances to enter the correct one on the same page. Variable testV iterates by +1 when the form is submitted with wrong codes. With how I have things currently written, when submit is pushed, the script simply cycles testV to 1, 2, 3...until testV hits 4, and moves the user to "try_3.html" immediately, instead of giving the 2nd and 3rd chances to enter. Any way to address this client-side? Source: http://community.livejournal.com/javascript/119125.html
|