ray Posted March 23, 2007 Report Posted March 23, 2007 (edited) Man ir kods, bet es nesaprotu iemeslu, kāpēc mans javascript nedarbojas: <script type="text/javascript"> var D = window.document; function kontakti() { var f = D.forma_k; err = ""; if ( !f.vards.value ) { err = "Lūdzu ievadiet vārdu."; } else if ( !f.telefons.value ) { err = "Lūdzu ievadiet telefonu.";} else if ( !f.telefons.value.mach( /^\d+$/ )) { err = "Nepareizs telefons";} else if ( !f.epasts.value ) { err = "Lūdzu ievadiet e-pastu.";} else if ( !f.teksts.value ) { err = "Lūdzu ievadiet tekstu.";} if ( err ) { alert( err ); return false; } else { return true; } } </script> <form method="post" action="kontakti.php" name="forma_k" onSubmit="return kontakti();"> <TABLE WIDTH="270" border="0"> <TR><TD>Vārds: </TD><TD width="135"><input type="text" name="vards"></TD></TR> <TR><TD>Telefons: </TD><TD width="135"><input type="text" name="telefons"></TD></TR> <TR><TD>E-pasts: </TD><TD width="135"><input type="text" name="epasts"></TD></TR> <TR><TD colspan="2"><textarea name="teksts" cols="40" rows="10"></textarea></TD></TR> <TR><TD colspan="2" align="center"><input type="submit" name="submit" value="SŪTĪT"></TD></TR> </TABLE> Edited March 23, 2007 by ray
andrisp Posted March 23, 2007 Report Posted March 23, 2007 (edited) Tādu pašu kļūdainu iemetu iekš dokumenta un man viss worko -> http://paste.php.lv/5339 1) Ja neiet kaut kas specifisks, tad tā arī saki. 2) Izmanto error konsoli. 3) Tev tur ir typo kļūdiņa - mach -> match Edited March 23, 2007 by andrisp
ray Posted March 23, 2007 Author Report Posted March 23, 2007 Paldies, kļūda bija vnk vārdā mach --> match.
Recommended Posts