![]() |
# 1 |
חבר וותיק
|
גאווה סקריפט | לא מוצא את הבעיה
היי, רשמתי את הקוד הבא והוא אמור לבצע ככה: אם הערך ריק אז המסגרת הופכת לאדום ואם הערך גדול מ2 הוא אמור לצבוע לירוק ומשום מה זה פשוט לא עובד נכון. אם אני מכניס ערך כלשהו אפילו שהוא קטן מ 2 הוא מסמן בירוק ואם הערך ריק הוא לא מסמן באדום כמו שהוא אמור להיות ובFF הוא בכלל לא עובד הקוד הזה.
הינה הקוד: HTML קוד:
<html dir="rtl"> <head> <title>s</title> <script language="javascript"> function check_error(id) { if (document.contact.id.length < 2) { document.getElementById(id).style.border="1px dotted #58B52D"; document.getElementById(id).style.background="url(accept.png) left no-repeat 10px;"; } else { document.getElementById(id).style.border="1px dotted red"; } } </script> <style> form.contact {width: 550px; background: url(icon_contact.gif) left top no-repeat 60px;} input.type {border: 1px dotted black; margin-top: 6px; color: #808080; width: 310px; font-size: 11px;} input.submit {border: 0px; font-size:11px; color: #FF5900; width: 80px; text-align: right; font-weight: bold; background: none; font-wieght: bold; font-size: 11px;} textarea.content {margin-top: 6px; font-size: 11px; border: 1px dotted #BFBFBF; font-family: "ariel", sans-serif; color: #808080; background: url(contact.gif) top repeat-x;} h3 { margin: 1px 1px 1px 1px; font-family:ariel, sans-serif ;} </style> </head> <body> <form method="post" action="" name="contact" class="contact" onload="void();"> <table> </table> <h3>פנייה ישירה בטלפון: 0546280268</h2> <input type="text" class="type" name="first_name" value='*שם פרטי' onclick="this.value=''" onkeypress="check_error('first_name');" /><br /> <input type="text" class="type" name="last_name" value='*שם משפחה' onclick="this.value=''" onkeypress="check_error('last_name');" /><br /> <input type="text" class="type" name="email" value='*דואר אלקטרוני' onclick="this.value=''" onkeypress="check_error('email');"/><br /> <input type="text" class="type" name="phone" value='טלפון' onclick="this.value=''" onkeypress="check_error('phone');" /><br /> <input type="text" class="type" name="pelephone" value='פלאפון' onclick="this.value=''" onkeypress="check_error('pelephone');" /><br /> <input type="text" class="type" name="fax" value='פקס' onclick="this.value=''" onkeypress="check_error('fax');" /><br /> <textarea name="content" class="content" onkeyup="check_error('content');" rows="10" cols="70">רשום כאן את תוכן הפנייה</textarea> </form> </body> </html> תודה לעוזרים! |
![]() |
![]() |
# 2 |
משתמש - היכל התהילה
|
תבדוק ככה
קוד:
document.getElementById(id).value.length < 2 עריכה: גם אתה בודק בכלל שאם זה קטן מ2 אז שיצבע לירוק... לא אדום.. Last edited by mlnn; 21-06-09 at 11:26.. |
![]() |
![]() |
# 3 |
חבר וותיק
|
תודה רבה אפילו לא שמתי לב לזה.
|
![]() |
![]() |
חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים) | |
כלים לאשכול | |
תצורת הצגה | |
|
|