16 תשובות
מה השאלה?
שואל השאלה:
איך אני עושה בדיקה שהזינו @ בדף הרשמה כזה כאילו כשצריך להכניס מייל אז לבדוק שבאמת יש שם כזה -@
איך אני עושה בדיקה שהזינו @ בדף הרשמה כזה כאילו כשצריך להכניס מייל אז לבדוק שבאמת יש שם כזה -@
יש לך אתת השאלה יותר מסודרת?
שואל השאלה:
בדיקת אימייל שכוללת לפחות את הסימן @ ומספר תווים לפניו ומספר תווים אחריו
בדיקת אימייל שכוללת לפחות את הסימן @ ומספר תווים לפניו ומספר תווים אחריו
function checkemail(email) {
const atsignindex = email.indexof('@');
if (atsignindex > 0 && email.length - atsignindex > 2) {
return true;
}
return false;
}
console.log(checkemail('[email protected]')); // true
console.log(checkemail('@example.com')); // false
console.log(checkemail('[email protected]')); // false
const atsignindex = email.indexof('@');
if (atsignindex > 0 && email.length - atsignindex > 2) {
return true;
}
return false;
}
console.log(checkemail('[email protected]')); // true
console.log(checkemail('@example.com')); // false
console.log(checkemail('[email protected]')); // false
שואל השאלה:
תודה רבה!! , בודקת אם זה עובד
תודה רבה!! , בודקת אם זה עובד
שואל השאלה:
לא עובד לי
לא עובד לי
הפכת את הסוגריים ? זה הפך בגלל המחשב
שואל השאלה:
https://ibb.co/3hw0fdt
https://ibb.co/3hw0fdt
קישורים מצורפים:
function checkemail(email, numbeforeat, numafterat) {
// check if the string contains an @ sign
if (email.indexof("@") === -1) {
return false;
}
// split the string into two parts at the @ sign
const parts = email.split("@");
// check if the first part has at least numbeforeat characters
if (parts[0].length < numbeforeat) {
return false;
}
// check if the second part has at least numafterat characters
if (parts[1].length < numafterat) {
return false;
}
// if all checks pass, return true
return true;
}
// example usage:
const email = "[email protected]";
const numbeforeat = 4;
const numafterat = 5;
console.log(checkemail(email, numbeforeat, numafterat)); // output: true
// check if the string contains an @ sign
if (email.indexof("@") === -1) {
return false;
}
// split the string into two parts at the @ sign
const parts = email.split("@");
// check if the first part has at least numbeforeat characters
if (parts[0].length < numbeforeat) {
return false;
}
// check if the second part has at least numafterat characters
if (parts[1].length < numafterat) {
return false;
}
// if all checks pass, return true
return true;
}
// example usage:
const email = "[email protected]";
const numbeforeat = 4;
const numafterat = 5;
console.log(checkemail(email, numbeforeat, numafterat)); // output: true
שואל השאלה:
כל זה בודק רק אם יש שטרודל?@?
כל זה בודק רק אם יש שטרודל?@?
קוד זה מגדיר פונקציה בשם checkemail שלוקחת כתובת דואר אלקטרוני כמחרוזת ושני מספרים כארגומנטים: numbeforeat ו-numafterat. הפונקציה בודקת תחילה אם כתובת הדואר האלקטרוני מכילה סימן @ בשיטת indexof. אם לא, הפונקציה מחזירה false. אם כן, הפונקציה מפצלת את כתובת המייל לשני חלקים עם הסימן @ בשיטת הפיצול ומאחסנת את החלקים במערך שנקרא חלקים.
לאחר מכן הפונקציה בודקת אם בחלק הראשון של כתובת הדואר האלקטרוני (החלק שלפני הסימן @) יש לפחות תווים numbeforeat באמצעות המאפיין length. אם לא, הפונקציה מחזירה false. באופן דומה, הפונקציה בודקת אם בחלק השני של כתובת הדואר האלקטרוני (החלק שאחרי הסימן @) יש לפחות תווים numafterat. אם לא, הפונקציה מחזירה false.
אם כל הבדיקות עוברות, הפונקציה מחזירה true. בשימוש לדוגמה, הפונקציה נקראת עם כתובת הדוא"ל "[email protected]", numbeforeat מוגדר ל-4, ו-numafterat מוגדר ל-5. הפונקציה מחזירה true כי כתובת הדוא"ל מכילה סימן @ ויש לה לפחות 4 תווים לפני ו-5 תווים אחרי סימן @.
לאחר מכן הפונקציה בודקת אם בחלק הראשון של כתובת הדואר האלקטרוני (החלק שלפני הסימן @) יש לפחות תווים numbeforeat באמצעות המאפיין length. אם לא, הפונקציה מחזירה false. באופן דומה, הפונקציה בודקת אם בחלק השני של כתובת הדואר האלקטרוני (החלק שאחרי הסימן @) יש לפחות תווים numafterat. אם לא, הפונקציה מחזירה false.
אם כל הבדיקות עוברות, הפונקציה מחזירה true. בשימוש לדוגמה, הפונקציה נקראת עם כתובת הדוא"ל "[email protected]", numbeforeat מוגדר ל-4, ו-numafterat מוגדר ל-5. הפונקציה מחזירה true כי כתובת הדוא"ל מכילה סימן @ ויש לה לפחות 4 תווים לפני ו-5 תווים אחרי סימן @.
שואל השאלה:
אוף נמאס לי אני לא יודעת מה לעשות פה
אוף נמאס לי אני לא יודעת מה לעשות פה
function validateemail(email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/;
return re.test(string(email).tolowercase());
}
function submitbutton_click() {
var email = document.getelementbyid("email").value;
if (!validateemail(email)) {
alert("please enter a valid email address.");
return false;
}
// submit the form or do other actions here
}
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-za-z\-0-9]+\.)+[a-za-z]{2,}))$/;
return re.test(string(email).tolowercase());
}
function submitbutton_click() {
var email = document.getelementbyid("email").value;
if (!validateemail(email)) {
alert("please enter a valid email address.");
return false;
}
// submit the form or do other actions here
}
<script type="text/javascript">
function validateemail() {
var email = document.getelementbyid("email").value;
if (email.indexof("@") == -1) {
alert("please enter a valid email address");
return false;
}
return true;
}
</script>
<form onsubmit="return validateemail()">
email: <input type="text" id="email" />
<input type="submit" value="submit" />
</form>
function validateemail() {
var email = document.getelementbyid("email").value;
if (email.indexof("@") == -1) {
alert("please enter a valid email address");
return false;
}
return true;
}
</script>
<form onsubmit="return validateemail()">
email: <input type="text" id="email" />
<input type="submit" value="submit" />
</form>
שואל השאלה:
אני פשוט שונאת את המשימה הזאתת
אני פשוט שונאת את המשימה הזאתת
באותו הנושא: