XHTML Event Yanayi Suna

واحدة من المزايا الجديدة في HTML 4.0 هي السماح لـ HTML بتنفيذ سلوكيات في المتصفح، مثل بدء سكربت جافا سكريبت عند الضغط على عنصر HTML. إليك سلسلة من الخصائص التي يمكن إدراجها في علامات HTML لتحديد سلوك الأحداث.

إذا كنت ترغب في تعلم كيفية استخدام هذه الأحداث للبرمجة، فعليك أن تتعلم من دليل JavaScript و دليل DHTML.

مؤثرات نافذة المتصفح (Window Events)

فعال فقط في عناصر body و frameset.

Attribute Value Description
onload Script تنفيذ سكربت عند تحميل الوثيقة
onunload Script تنفيذ سكربت عند إزالة الوثيقة

مؤثرات عناصر النموذج (Form Element Events)

فعال فقط في عناصر النموذج.

Attribute Value Description
onchange Script تنفيذ سكربت عند تغيير العنصر
onsubmit Script تنفيذ سكربت عند تقديم النموذج
onreset Script تنفيذ سكربت عند إعادة تعيين النموذج
onselect Script تنفيذ سكربت عند اختيار العنصر
onblur Script تنفيذ سكربت عند فقدان التركيز من العنصر
onfocus Script تنفيذ سكربت عند الحصول على التركيز من العنصر

مؤثرات لوحة المفاتيح (Keyboard Events)

فاقد الصلاحية في العناصر التالية: base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style، وكذلك عناصر title.

Attribute Value Description
onkeydown Script تنفيذ سكربت عند ضغط مفاتيح لوحة المفاتيح
onkeypress Script تنفيذ سكربت عند ضغط مفاتيح لوحة المفاتيح ثم إطلاقها
onkeyup Script تنفيذ سكربت عند إطلاق مفاتيح لوحة المفاتيح

مؤثرات الفأرة (Mouse Events)

فاقد الصلاحية في العناصر التالية: base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title عناصر.

Attribute Value Description
onclick Script Execute script when the mouse is clicked
ondblclick Script Execute script when the mouse is double-clicked
onmousedown Script Execute script when the mouse button is pressed
onmousemove Script Execute script when the mouse pointer moves
onmouseout Script Execute script when the mouse pointer moves out of an element
onmouseover Script Execute script when the mouse pointer hovers over an element
onmouseup Script Execute script when the mouse button is released