Имя пользователя:
Пароль:
 

Название темы: Помогите с JavaScript
Показать сообщение отдельно

Аватара для Guest

Guest


Профиль | Цитировать


[rus]pomogite pozhaluysta. Moy script ne rabotaet.Nuzhno chtob pri nazhatii na submit poyavlyalis alert esli polya ne zapolneni. POMOGITE KTO NIBUD.[/rus]
Код: Выделить весь код
<HTML>
<HEAD>
<TITLE>Registration</TITLE>
<SCRIPT>

function validateForm()

{
 * if (document.registration.first.value == "") 
 * { 
 * * *alert("Please enter your First Name!"); 
 * * * 
 * * *first.focus();
 * * * return false;
 * } 
 {
 * if (document.registration.last.value == "") 
 * { 
 * * *alert("Please enter your Last Name!"); 
 * * * 
 * * *last.focus();
 * * *return false;
 * } 
{
 * if (document.registration.date.value == "") 
 * { 
 * * *alert("Please enter your *Date of Birth!")
 * * * 
 * * *date.focus();
 * * *return false;
 * } 


{
 * if (document.registration.month.value == "") 
 * { 
 * * *alert("Please enter your Month of Birth!"); 
 * * * 
 * * *birth.focus();
 * * *return false;
 * } 


{
 * if (document.registration.year.value == "") 
 * { 
 * * *alert("Please enter your Year of Birth!"); 
 * * * 
 * * *year.focus();
 * * *return false;
 * } 

{
 * if (document.registration.phone.value == "") 
 * { 
 * * *alert("Please enter your Phone Number!"); 
 * * * 
 * * *phone.focus();
 * * *return false;
 * } 

{
 * if (document.registration.email.value == "") 
 * { 
 * * *alert("Please enter your E-mail Address!"); 
 * * * 
 * * *email.focus();
 * * *return false;
 * } 

function doClear()
{

document.registration.first.value="";
document.registration.last.value="";
document.registration.date.value="";
document.registration.month.value="";
document.registration.year.value="";
document.registration.phone.value="";
document.registration.email.value="";
document.registration.gender[0].checked=false;
document.registration.gender[1].checked=false;
document.registration.gender[2].checked=false;
return;
}

</SCRIPT>
</HEAD>
<BODY>
<form name = "registration" method = "post">
This project is done by Zhdanova Anastasia sec-o1.<br>

(my function does not work. I don't know why :-(



<H1>Registration</H1>
<BR>
<H4>Please,enter the information below:</H4>
<FONT FACE="Courier">
First Name:&nbsp;&nbsp;&nbsp;&nbsp;<INPUT NAME="first" TYPE="TEXT" Size=50><BR>
Last Name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT NAME="last" TYPE="TEXT" Size=50><BR>
Date of birth:&nbsp;&nbsp;
Date:<INPUT NAME="date" TYPE="TEXT"Size=4>
Month:<INPUT NAME="month" TYPE="TEXT"Size=4>
Year:<INPUT NAME="year" TYPE="TEXT" Size=4><BR>

Phone:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT NAME="phone" TYPE="TEXT" SIZE=9><BR> 
E-mail address:<INPUT NAME="email" TYPE="TEXT" Size=50><BR>
<BR>
Gender:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<INPUT NAME="gender" TYPE="RADIO">Male
<INPUT NAME="gender" TYPE="RADIO">Female
<INPUT NAME="gender" TYPE="RADIO">Prefer not to answer<BR>
</FONT>
<BR><BR>


<INPUT TYPE="BUTTON" VALUE="Submit" onClick="validateForm"()>
<INPUT TYPE="BUTTON" VALUE="Clear all" onClick="doClear()">
</form>
</BODY>
</HTML>
[s]Исправлено: Prisoner, 3:45 10-04-2004[/s]

Отправлено: 07:21, 09-04-2004 | #9

Название темы: Помогите с JavaScript