Jump to content
php.lv forumi

kkas nav


ray

Recommended Posts

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 by ray
Link to comment
Share on other sites

×
×
  • Create New...