OVERENIE FORMULARA

ID
Nazov / Name:
Popis / Description:
Dlzka / Length:
Testovane pod / Tested under:

 

036
p036.html / p036.zip
Overi, ci bol napisany platny ZIP kod
2823b
NN 4.04, IE 4.0

UKAZKA / CLICK HERE

Zdrojovy tvar / Source code:

<html> <head> <title> JavaScript DESTINATION - P036 </title> <script Language="JavaScript"> <!-- function runSubmit (form, button) { var flag = new Boolean (); flag = true; if (flag && (form.zip.value=="")) { flag = false; validatePrompt (form.zip, "Prosim napiste ZIP kod") } if (flag && (form.zip.value.length != 5 && form.zip.value.length != 10)) { flag = false; validatePrompt (form.zip, "ZIP kod musi byt vo formate XXXXX alebo XXXXX-XXXX.") } if (flag && (form.zip.value.length != 5 && form.zip.value.length != 10)) { validatePrompt (form.zip, "ZIP kod musi byt vo formate XXXXX alebo XXXXX-XXXX.") flag = false; } for (index = 4; flag && index >= 0; index--) { ch = form.zip.value.charAt(index); if (ch != "0" && ch != "1" && ch != "2" && ch != "3" && ch != "4" && ch != "5" && ch != "6" && ch != "7" && ch != "8" && ch != "9") { validatePrompt (form.zip, "ZIP kod musi byt vo formate XXXXX alebo XXXXX-XXXX.") flag = false; } } for (index = form.zip.value.length - 1; flag && (index > 5); index--) { ch = form.zip.value.charAt(index); if (ch != "0" && ch != "1" && ch != "2" && ch != "3" && ch != "4" && ch != "5" && ch != "6" && ch != "7" && ch != "8" && ch != "9") { validatePrompt (form.zip, "ZIP kod musi byt vo formate XXXXX alebo XXXXX-XXXX.") flag = false; } } if (flag && form.zip.value.indexOf("-") != 5 && form.zip.value.length == 10) { validatePrompt (form.zip, "ZIP kod musi byt vo formate XXXXX alebo XXXXX-XXXX.") flag = false; } if (flag){ validatePrompt (form.Submit, "Formular je platny a bol vyslany!") } return flag; } function validatePrompt (Ctrl, prompt) { alert (prompt) Ctrl.focus(); } //--> </script> </head> <body> <center> <FORM NAME="test" METHOD="POST" onSubmit='return runSubmit();' ACTION="mailto:unknown@unknown.sk"> <table> <tr><th align=center><bold>PSC:</bold> <td align=center><input type="text" size=10 name="zip"><tr> <tr><th><th></tr> <tr><th></tr> <tr><th><td align=center><input type="button" name="Submit" value="Over PSC" onClick="runSubmit(this.form,this)"></tr> </table> <p><br><p> <imput type="button" name="Reset" value="Vynuluj"> </form><p> </center> </body> </html>
[ Navrat / BACK ]