פורסם 2006 ביוני 619 שנים הנה הקוד: <script language="javaScript"> function chackForm() { var msg; var num = 0; msg=" " ; if(document.club.firstname.value.length == 0) { msg = msg + "Firstname field is empty\n" ; num = 1; } if(document.club.firstname.value.length > 15) { msg = msg + "First name is too long\n" ; num = 1; } if(document.club.firstname.value.length == 1) { msg = msg + "First name is too short\n" ; num = 1; } if(document.club.lastname.value.length == 0) { msg = msg + "Last name field is empty\n" ; num = 1; } if(document.club.lastname.value.length > 15) { msg = msg + "Last name is too long\n" ; num = 1; } if(document.club.lastname.value.length == 1) { msg = msg + "Last name is too short\n" ; num = 1; } if(document.club.email.value.length == 0) { msg = msg + "eMail field is empty\n" ; num = 1; } if((document.club.email.value.indexOf("@") == -1)&&(document.club.email.value.length > 0)) { msg = msg + "shtrudel is missing in the eMail\n" ; num = 1; } if((document.club.email.value.indexOf(".") == -1)&&(document.club.email.value.length > 0)) { msg = msg + "Dot is missing in the email\n" ; num = 1; } if((document.club.email.value.length < 6)&&(document.club.email.value.length > 0)) { msg = msg + "Email can be at least 6 characters long\n" ; num = 1; } if(document.club.email.value.length > 25) { msg = msg + "Email is too long\n" ; num = 1; } if((document.club.phonenumber.value.length < 10)&&(document.club.phonenumber.value.length > 0)) { msg = msg + "phone number too short\n" ; num = 1; } if(document.club.phonenumber.value.length > 10) { msg = msg + "phone number is too long\n" ; num =1; } if(isNaN(document.club.phonenumber.value)) { msg = msg + "phone number can containe numbers only!\n" ; num = 1; } if((document.club.icq.value.length < 5)&&(document.club.icq.value.length > 0)) { msg = msg + "Icq number too short\n" ; num = 1; } if(isNaN(document.club.icq.value)) { msg = msg + "Icq number can containe numbers only!\n" ; num = 1; } if((document.club.icq.value.length > 12)&&(document.club.icq.value.length > 0)) { msg = msg + "Icq number is too long\n" ; num = 1; } if((document.club.year.value < 1890)&&(document.club.year.value >= 0)) { if(document.club.year.value.length > 0) { msg = msg + "Ilogical birth year\n" ; num = 1; } } if(num == 0) { msg = "great!" ; } alert(msg); } </script>עכשיו מה שאני רוצה שבמקום לעשות alert הוא יחליף טקסט שכבר קיים בדף. או ידפיס את הארור בתוך טבלה.תודה מראש לכל העוזרים.
פורסם 2006 ביוני 619 שנים אתה צריך להגדיר div עם name ו-id(שיהיו מן הסתם אותו שם נקרא לו kuku)ואז אתה עושה:kuku.innerHTML = msgסליחה טעותdocument.getElementById(kuku).innerHTML = msg
פורסם 2006 ביוני 719 שנים כמו גדול<html> <head></head> <body> <span onClick=document.getElementById(123).innerHTML=("hello")>push</span> <div id = 123></div> </body></html>
פורסם 2006 ביוני 719 שנים קצת קטנוניות:<html> <head><title></title></head> <body> <div onClick="document.getElementById('123').innerHTML=('hello'); ">push</div> <div id="123"></div> </body></html>
פורסם 2006 ביוני 719 שנים האמת היא שזה לא כל כך קטנוני ועדיף שהוא ילמד איך כותבים נכון ולא איך כותבים בשנייה וחצי רק בשביל להגיד "עובד"
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.