طلب منا الدكتور العمل على مشروع يتطلب العلم بالجافا سكربت إلا أننا لا نمتلك معلومات عن الجافا سكربت.
حاولت كل ما أستطيع وبعد أن وقفت عند نقطة استمرت مع وقت طويل تذكرت أن أحد الأشخاص نصحني من قبل بالتسجيل في هذا المنتدى وقال لي أنكم تستطيعون مساعدتي إن شاء الله
السورس
اقتباس<html><head>
<title>Registration</title>
</head>
<body bgcolor = "black">
<script language = "javascript">
// Check Name
function checkName(form)
{
if( form.Name.value.length < 6 )
{
window.alert("Name must be at least 6 characters long");
return false;
}
return true;
}
// Check Phone
function checkPhone(form)
{
if( form.Phone.value.length < 9 )
{
window.alert("Phone must be at least 9 characters long");
return false;
}
return true;
}
// Check UserName
function checkUserName(form)
{
if( form.UserName.value.length < 8 )
{
window.alert("UserName must at least 8 characters long");
return false;
}
return true;
}
// Check Password
function checkPassword(form)
{
if(form.Password.value.length < 6 )
{
window.alert("Password must be at least 6 characters long");
return false;
}
return true;
}
// Check Region
function checkRegion(form)
{
if ( ( document.Region.Eastern.checked == false )
&& ( document.Region..Western.checked == false )
&& ( document.Region..Hail.checked == false )
&& ( document.Region..Southren.checked == false ) )
{
alert ( "Please choose your Gender: Male or Female" );
valid = false;
}
function checkForm(form)
{
if ((form.Name.value.length == 0) ||
(form.Phone.value.length == 0) ||
(form.UserName.value.length == 0) ||
(form.Password.value.length == 0))
{
alert("All fields must be filled in. Form Not submitted.");
return false;
}
return true;
}
// if we got here - submit it!
function clearForm(form)
{
form.Name.value = " ";
form.Phone.value = " ";
form.UserName.value = " ";
form.Password.value = " ";
}
</script>
<table border cellspacing = 0 height = "550" width = "750">
<!-- Fist Row -->
<tr>
<td width=25% height=100px><P align = "center"><img src = "images/Logo.jpg" width = 170 height = 100%></P></td> <!--Logo-->
<!-- <td>02</td>
<td>03</td> -->
<td colspan = 3><P align = "center"><img src = "images/Banner.jpg" width = 570px height = 100%></P></td> <!--Banner-->
</tr>
<!-- Second Row -->
<tr height = 40>
<td><P align = "center"><a href = "register.html">Register</a></P></td> <!-- Register -->
<td><P align = "center"><a href = "Scripts/catagory.asp">eCatalog</a></P></td> <!-- eCatalog -->
<td><P align = "center"><a href = "contact.html">Contact</a></P></td> <!-- Contact -->
<td><P align = "center"><a href = "about.html">About</a></P></td> <!-- About -->
</tr>
<!-- Third Row -->
<tr>
<form method="GET" action="step2.asp" onSubmit="return checkForm(this)">
<td colspan = 3 rowspan = 3 valign=top><font color = "white"><br>
<b>Name</b> <input type = text name = Name onChange = checkName(this.form)>
<p>
<b>Phone</b> <input type = text name = Phone onChange = checkPhone(this.form)>
<p>
<b>User Name</b> <input type = text name = UserName onChange = checkUserName(this.form)>
<p>
<b>Password</b> <input type = "Password" name = Password onChange = checkPassword(this.form)>
<p>
<b>Region :</b>
<p>
<input type = radio name = Region value = "Eastern" checkRegion(this.form)>Eastern
<p>
<input type = radio name = Region value = "Western" checkRegion(this.form)>Western
<p>
<input type = radio name = Region value = "Hail" checkRegion(this.form)>Hail
<p>
<input type = radio name = Region value = "Southren" checkRegion(this.form)>Southren
<br><p align="left"> <i>User Names more than 10 characters will not be accepted<br> Maximum length for the password is 15 characters</i>
<p align="Center"><input type = "submit" value = "send" onClick = checkForm(this.form)>
</td>
</form>
<!-- <td>10</td>
<td>11</td> -->
<td width = 25% height = 115px><P align = "center"><a href="http://192.168.205.99"><img src = "images/Salman.jpg" width = 140 height = 100% border = 0></a></P></td> <!--Salman's Ad-->
</tr>
<!-- Fourth Row -->
<tr>
<!-- <td>13</td>
<td>14</td>
<td>15</td> -->
<td width = 25% height = 115px><P align = "center"><a href="http://192.168.205.119"><img src = "images/Nasser.jpg" width = 140 height = 100% border = 0><a/></P></td> <!--Nasser's Ad-->
</tr>
<!-- Fifth Row -->
<tr>
<!-- <td>17</td>
<td>18</td>
<td>19</td> -->
<td width = 25% height = 115px><P align = "center"><a href="http://192.168.205.70"><img src = "images/Rasheed.gif" width = 140 height = 100% border = 0></a></P></td> <!--Rasheed's Ad-->
</tr>
</table>
</body>
</html>
المشكلة الموجودة في الصفحة هي أنني أعمل على Form Validation وقد تمكنت من جعله يتأكد من كل من :
Name, Phone, User Name, Password
إلا أنني لم أستطع أن أجعله يعمل مع Region لأنها من نوع Radio وليست كباقي الحقول من نوع Text.
أرجو منكم المساعدة العاجلة فيجب علي أن أسلم المشروع يوم السبت القادم.
ولكم تحياتي
