עבור לתוכן

בעיה ב javascript

Featured Replies

פורסם

אז ככה אני מריץ IIS במחשב יש לי פרוייקט אתר. הטופס עובד מעולה עם המסד נתונים עכשיו אני רוצה לבדוק את תקינות הכנסת הנתונים בטקסטים של HTML עשיתי את זה עם JS ומשום מה כתוב לי שאין הרשאה או משהו כזה ונתתי הרשאה לכל הדפים.

הנה הקוד תגידו לי אם הוא תקין ואם אפשר ממה הבעיה נובעת.


<html>
<head>
<script language="JavaScript">
function is_empty (str){
if (str=="")
return false;
}
function check_wt (str){
if (str.length<2)
return false;

}
function check_ID (str){
if (str.length!=9)
return false;
}
function onlyLetters (str){
for (i=0;i<str.length;i++)
for(j=0;j<=9;j++)
if (str.indexOf(j)!=(-1))
return false;
}
function onlyNumbers (str){
for (i=0;i<str.length;i++)
if (str.charAt(i)>='a' && str.charAt(i)<='z' || str.charAt(i)>='A' && str.charAt(i)<='Z' || str.charAt(i)>='א' && str.charAt(i)<='ת')
return false;
}
function Age_0_120 (str){
if (str<0 || str>120)
return false;
}
function checkMail (str){
//====
//Start Check Mail By Shay.
//====
if ((str.indexOf("@") ==-1) && (str.indexOf(".") ==-1))
return false;
if (str.indexOf("@")>str.indexOf("."))
return false;
//Check IF there are 2 @ or more
if ((str.split("@").length)!=2)
return false;

}
function CheckTelePhoneLength (str){
if (str.length!=10)
return false;
}
function CheckTelePhone (str){
if(str.charAt(0)!=0)
return false;
for (i=0;i<=1;i++){
if (str.charAt(i)>='a' && str.charAt(i)<='z' || str.charAt(i)>='A' && str.charAt(i)<='Z' || str.charAt(i)>='א' && str.charAt(i)<='ת' || str.charAt(i)=="-")
return false;
}
if (str.charAt(2)!="-")
return false;
for (i=3;i<str.length;i++){
if (str.charAt(i)>='a' && str.charAt(i)<='z' || str.charAt(i)>='A' && str.charAt(i)<='Z' || str.charAt(i)>='א' && str.charAt(i)<='ת' || str.charAt(i)=="-")
return false;
}
}//end function CheckTelephone
function checkForm (){
if (is_empty(document.tofes.fname.value)==false){
window.alert ("נא להקליד שם פרטי");
document.tofes.fname.focus();
document.tofes.fname.select();
return false;
}
if (check_wt(document.tofes.fname.value)==false){
window.alert ("חובה להקליד לפחות 2 אותיות\nבשם הפרטי");
document.tofes.fname.focus();
document.tofes.fname.select();
return false;
}
if (onlyLetters(document.tofes.fname.value)==false){
window.alert ("בשם הפרטי אסור להכניס מספרים");
document.tofes.fname.focus();
document.tofes.fname.select();
return false;
}
if (is_empty(document.tofes.lname.value)==false){
window.alert ("נא להקליד שם משפחה");
document.tofes.lname.focus();
document.tofes.lname.select();
return false;
}
if (check_wt(document.tofes.lname.value)==false){
window.alert ("חובה להקליד לפחות 2 אותיות\nבשם המשפחה");
document.tofes.lname.focus();
document.tofes.lname.select();
return false;
}
if (onlyLetters(document.tofes.lname.value)==false){
window.alert ("בשם המשפחה אסור להכניס מספרים");
document.tofes.lname.focus();
document.tofes.lname.select();
return false;
}
if (is_empty(document.tofes.sisma.value)==false){
window.alert ("נא להקליד סיסמא");
document.tofes.pass_1.focus();
document.tofes.pass_1.select();
return false;
}

if (is_empty(document.tofes.sisma1.value)==false){
window.alert ("נא להקליד אימות סיסמא");
document.tofes.pass_2.focus();
document.tofes.pass_2.select();
return false;
}
if (document.tofes.pass_1.value != document.tofes.sisma2.value){
window.alert ("הסיסמאות לא זהות");
document.tofes.pass_1.focus();
document.tofes.pass_1.select();
return false;
}
if (is_empty(document.tofes.gander.value)==false){
window.alert ("נא לבחור מין");
document.tofes.gander.focus();
document.tofes.gander.select();
return false;

}
if (is_empty(document.tofes.c_phone.value)==false){
window.alert ("נא להקליד פלא");
document.tofes.c_phone.focus();
document.tofes.c_phone.select();
return false;
}
if (CheckTelePhone(document.tofes.c_phone.value)==false){
window.alert ("מספר טלפון לא תקין");
document.tofes.c_phone.focus();
document.tofes.c_phone.select();
return false;
}
if (CheckTelePhoneLength(document.tofes.c_phone.value)==false){
window.alert ("מספר טלפון לא תקין");
document.tofes.c_phone.focus();
document.tofes.c_phone.select();
return false;
}
if (is_empty(document.tofes.email.value)==false){
window.alert ("נא להקליד אימייל");
document.tofes.email.focus();
document.tofes.email.select();
return false;
}
if (checkMail(document.tofes.email.value)==false){
window.alert ("אנא תקן את האימייל שהכנסת.\nהאימייל לא תקין");
document.tofes.email.focus();
document.tofes.email.select();
return false;
}
if (is_empty(document.tofes.id.value)==false){
window.alert ("נא להקליד ת.ז");
document.tofes.id.focus();
document.tofes.id.select();
return false;
}
if (check_ID(document.tofes.id.value)==false){
window.alert ("מספר ת.ז חייב להכיל 9 ספרות בדיוק");
document.tofes.id.focus();
document.tofes.id.select();
return false;
}
if (onlyNumbers(document.tofes.id.value)==false){
window.alert ("מספר תעודת הזהות חייב להכיל מספרים בלבד");
document.tofes.id.focus();
document.tofes.id.select();
return false;
}
if (is_empty(document.tofes.age.value)==false){
window.alert ("נא להקליד גיל");
document.tofes.age.focus();
document.tofes.age.select();
return false;
}
if (onlyNumbers(document.tofes.age.value)==false){
window.alert ("הגיל חייב להכיל מספרים בלבד");
document.tofes.age.focus();
document.tofes.age.select();
return false;
}
if (Age_0_120(document.tofes.age.value)==false){
window.alert ("הגיל חייב להיות בין 0-120");
document.tofes.age.focus();
document.tofes.age.select();
return false;
}
return true;
}
</script>

</script>
</head>
<title>טופס הרשמה
</title>
<body dir="rtl" background="images/website_05.gif">
<font type="ariel" size="3" color="black" dir="rtl">
<i>
<center>
<form method="post" action="insert.asp" onsubmit="return checkForm()">
<table border="2" bordercolor="white" textcolor="brown">
<h3>
מלא את השדות הריקים:
</h3>
<hr>
<tr>
<td>
<input type="text" name="fname" size="25" maxlength="15"> שם פרטי*
</td>
</tr>
<br>
<tr>
<td>
<input type="text" name="lname" size="25" maxlength="15">שם משפחה
</td>
</tr>
<br>
<tr>
</tr>
<br>
<tr>
<td>
<input type="text" name="c_phone" size="25" maxlength="15">מספר פלא+קידומת
</td>
</tr>
<br>
<tr>
<td>
<input type="password" name="pass_1" size="25" maxlength="15">סיסמא
</td>
</tr>
<tr>
<td>
<input type="password" name="pass_2" size="25" maxlength="15">אימות סיסמא
</td>
</tr>
<br>
<tr>
<td>
<input type="text" name="id" size="25" maxlength="15">ת.ז
</td>
</tr>
<br>
<tr>
<td>
____עיר מגורים
<select>
<option>אשקלון</option>
<option>גבעתיים</option>
<option>רמת-גן</option>
</select>
</td>
</tr>
<br>
<tr>
<td>
<input type="text" name="s_name" size="25" maxlength="15">שם הרחוב
</td>
</tr>
<tr>
<td>
<input type="text" name="h_num" size="25" maxlength="15">מספר הבית
</td>
</tr>
<br>
<tr>
<td>
<u>
מין:
</u>
<input type="radio" name="gender" value="male" checked>זכר
<input type="radio" name="gender" value="female">נקבה
</td>
</tr>
<br>
<tr>
<td>
<u>
<input type="text" name="age" size="25" maxlength="15">גיל
<u>
</tr>
</td>
<tr>
<td>
<center>
<u>
בקשה מיוחדת
</u>
<br>
<textarea cols=50 rows="5" name="special">
הקלד את תוכן הבקשה כאן
</textarea>
</center>
</td>
</tr>
<tr>
<td>
<center>
<input type="submit" name="submit" value="שלח" action="insert.asp" method="post">
<input type="reset" name="reset" value="נקה">
</center>
</td>
</tr>
</form>
</html>

פורסם

מי כותב לך שאין הרשאה? יעזור אם תעתיק את ההודעה לפה

והרשאה לא קשורה לקוד

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים