• HTML 4.0 Event Attributes


    HTML 4.0 Event Attributes


    New to HTML 4.0 is 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 attributes that can be inserted into HTML tags to define event actions.


    Window Events

    Only valid in body and frameset elements.

    Attribute Value Description
    onload script Script to be run when a document loads
    onunload script Script to be run when a document unloads


    Form Element Events

    Only valid in form elements.

    Attribute Value Description
    onchange script Script to be run when the element changes
    onsubmit script Script to be run when the form is submitted
    onreset script Script to be run when the form is reset
    onselect script  Script to be run when the element is selected
    onblur script  Script to be run when the element loses focus
    onfocus script  Script to be run when the element gets focus


    Keyboard Events

    Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements.

    Attribute Value Description
    onkeydown script  What to do when key is pressed
    onkeypress script  What to do when key is pressed and released
    onkeyup script  What to do when key is released


    Mouse Events

    Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, title elements.

    Attribute Value Description
    onclick script  What to do on a mouse click
    ondblclick script  What to do on a mouse double-click
    onmousedown script  What to do when mouse button is pressed
    onmousemove script  What to do when mouse pointer moves
    onmouseout script What to do when mouse pointer moves out of an element
    onmouseover script What to do when mouse pointer moves over an element
    onmouseup script  What to do when mouse button is released

     

    Attribute definitions

    onload = script [CT]
    The onload event occurs when the user agent finishes loading a window or all frames within a FRAMESET. This attribute may be used with BODY and FRAMESET elements.
    onunload = script [CT]
    The onunload event occurs when the user agent removes a document from a window or frame. This attribute may be used with BODY and FRAMESET elements.
    onclick = script [CT]
    The onclick event occurs when the pointing device button is clicked over an element. This attribute may be used with most elements.
    ondblclick = script [CT]
    The ondblclick event occurs when the pointing device button is double clicked over an element. This attribute may be used with most elements.
    onmousedown = script [CT]
    The onmousedown event occurs when the pointing device button is pressed over an element. This attribute may be used with most elements.
    onmouseup = script [CT]
    The onmouseup event occurs when the pointing device button is released over an element. This attribute may be used with most elements.
    onmouseover = script [CT]
    The onmouseover event occurs when the pointing device is moved onto an element. This attribute may be used with most elements.
    onmousemove = script [CT]
    The onmousemove event occurs when the pointing device is moved while it is over an element. This attribute may be used with most elements.
    onmouseout = script [CT]
    The onmouseout event occurs when the pointing device is moved away from an element. This attribute may be used with most elements.
    onfocus = script [CT]
    The onfocus event occurs when an element receives focus either by the pointing device or by tabbing navigation. This attribute may be used with the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.
    onblur = script [CT]
    The onblur event occurs when an element loses focus either by the pointing device or by tabbing navigation. It may be used with the same elements as onfocus.
    onkeypress = script [CT]
    The onkeypress event occurs when a key is pressed and released over an element. This attribute may be used with most elements.
    onkeydown = script [CT]
    The onkeydown event occurs when a key is pressed down over an element. This attribute may be used with most elements.
    onkeyup = script [CT]
    The onkeyup event occurs when a key is released over an element. This attribute may be used with most elements.
    onsubmit = script [CT]
    The onsubmit event occurs when a form is submitted. It only applies to the FORM element.
    onreset = script [CT]
    The onreset event occurs when a form is reset. It only applies to the FORM element.
    onselect = script [CT]
    The onselect event occurs when a user selects some text in a text field. This attribute may be used with the INPUT and TEXTAREA elements.
    onchange = script [CT]
    The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.

    REF:

    http://www.w3.org/TR/REC-html40/interact/scripts.html

    http://www.w3schools.com/Html/html_eventattributes.asp

    http://msdn.microsoft.com/en-us/library/ms533051.aspx

  • 相关阅读:
    字符集转换
    基础语法
    python print格式化输出。
    错误:SyntaxError: Missing parentheses in call to 'print'
    delphi 线程教学第一节:初识多线程
    delphi 7 信息对话框的按钮屏蔽键盘操作,只允许鼠标点击
    delphi 7 下安装 indy 10.5.8 教程
    delphi 实现vip126发邮件
    delphi 基础书籍推荐
    delphi 编码速度提升技能
  • 原文地址:https://www.cnblogs.com/emanlee/p/1417131.html
Copyright © 2020-2023  润新知