حدث OnFocus هو حدث يحدث عندما يسقط المؤشر في مربع النص.
حدث Onblur هو حدث يحدث عندما يفقد المؤشر التركيز.
يمكنك كتابة المثال التالي
1.html
<html> <head> <title> استخدم معالج الأحداث OnBlur </title> </head> <bgcolor = "lavender"> <form name = "f1"> <input type = text name = text1 value = "1111onblur_green" onblur = "(document.bgcolor = 'green')" onblur = "(document.bgColor = 'Black')"> <type type = text name = text2 value = "3333onblur_yellow" onBlur = "(document.bgColor = 'Yellow')"> <br> <p> <pp input type = text3 value = "444444onfocus_blue" اكتب = اسم النص = text4 value = "55555onfocus_red" onfocus = "(document.bgColor = 'Red')> <input type = text name = text4 value =" 6666onfocus_orange "onfocus =" (document.bgcolor = 'orang
هناك أيضًا أمثلة أدناه
2.html
<!-وصف الملف: حدث onfocus-> <!- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- <type type = "text" name = "test2" value = "لا يمكنني إيقاف تشغيله بمجرد الضغط علي ، هاها" onfocus = Alert ("لقد أصبحت تركيز الإدخال!)> </form> </body> </html>يتحدث الكليشيه أعلاه عن حادثة Onblur وحادث Onfocus (JS) كلها المحتوى الذي أشاركه معك. آمل أن تتمكن من إعطائك مرجعًا وآمل أن تتمكن من دعم wulin.com أكثر.