w3pop.com :: ÍøÂçѧԺ :: JavaScript :: JSʼþ²Î¿¼
Events are normally used in combination with functions, and the function will not be executed before the event occurs!
ʼþÒ»°ãºÍº¯ÊýÊÇ»ìºÏʹÓõģ¬ÔÚʼþ·¢ÉúÒÔǰһ°ãº¯ÊýÊDz»»áÖ´Ðеģ¡
New to HTML 4.0 was the ability to let HTML events trigger actions in the browser, like starting a JavaScript when a user clicks on an HTML element. Below is a list of the attributes that can be inserted into HTML tags to define event actions.
HTML4.0µÄÐÂÊôÐÔ¾ÍÊÇ¿ÉÒÔÔÚä¯ÀÀÆ÷Öм¤·¢HTMLʼþ¡£µ±Óû§µã»÷Ò»¸öÒ»¸öHTMLÔªËØÊ±£¬¿ÉÒÔ¼¤·¢JS¡£ÏÂÃæµÄÁбíÁоÙÁË¿ÉÒÔ²åÈëHTML±êÇ©ÖÐÀ´¶¨Òåʼþ¶¯×÷µÄÊôÐÔ¡£
FF: Firefox, N: Netscape, IE: Internet Explorer
FF:»ðºü£¬N:Íø¾°£¬IE
| Attribute ÊôÐÔ |
The event occurs when... ʼþ·¢Éúʱ»ú |
FF | N | IE |
|---|---|---|---|---|
| onabort | Loading of an image is interrupted ͼƬÏÂÔØ±»´ò¶Ïʱ |
1 | 3 | 4 |
| onblur | An element loses focus ÔªËØÊ§È¥½¹µãʱ |
1 | 2 | 3 |
| onchange | The content of a field changes ¿òÄÚÈݸıäʱ |
1 | 2 | 3 |
| onclick | Mouse clicks an object Êó±êµã»÷Ò»¸ö¶ÔÏóʱ |
1 | 2 | 3 |
| ondblclick | Mouse double-clicks an object Êó±êË«»÷Ò»¸ö¶ÔÏóʱ |
1 | 4 | 4 |
| onerror | An error occurs when loading a document or an image µ±¼ÓÔØÎĵµ»òͼƬʱ·¢Éú´íÎóʱ |
1 | 3 | 4 |
| onfocus | An element gets focus µ±ÔªËØ»ñÈ¡½¹µãʱ |
1 | 2 | 3 |
| onkeydown | A keyboard key is pressed °´Ï¼üÅ̰´¼üʱ |
1 | 4 | 3 |
| onkeypress | A keyboard key is pressed or held down °´Ï»ò°´×¡¼üÅ̰´¼üʱ |
1 | 4 | 3 |
| onkeyup | A keyboard key is released ·Å¿ª¼üÅ̰´¼üʱ |
1 | 4 | 3 |
| onload | A page or an image is finished loading Ò³Ãæ»òͼƬ¼ÓÔØÍê³Éʱ |
1 | 2 | 3 |
| onmousedown | A mouse button is pressed Êó±ê±»°´ÏÂʱ |
1 | 4 | 4 |
| onmousemove | The mouse is moved Êó±ê±»Òƶ¯Ê± |
1 | 6 | 3 |
| onmouseout | The mouse is moved off an element Êó±êÀë¿ªÔªËØÊ± |
1 | 4 | 4 |
| onmouseover | The mouse is moved over an element Êó±ê¾¹ýÔªËØÊ± |
1 | 2 | 3 |
| onmouseup | A mouse button is released ÊÍ·ÅÊó±ê°´¼üʱ |
1 | 4 | 4 |
| onreset | The reset button is clicked ÖØÐµã»÷Êó±ê°´¼üʱ |
1 | 3 | 4 |
| onresize | A window or frame is resized µ±´°¿Ú»ò¿ò¼Ü±»ÖØÐ¶¨Òå³ß´çʱ |
1 | 4 | 4 |
| onselect | Text is selected Îı¾±»Ñ¡Ôñʱ |
1 | 2 | 3 |
| onsubmit | The submit button is clicked µã»÷Ìá½»°´Å¥Ê± |
1 | 2 | 3 |
| onunload | The user exits the page Óû§Àë¿ªÒ³ÃæÊ± |
1 | 2 | 3 |
ÆÀÂÛ (0)
All