| 网站首页 | 文章中心 | 电子书下载 | 矢量图库 | 视频教程 | 素材下载 | 程序代码下载 | JS代码 | 论坛 | 
常用软件类:
|杀毒安全 |联络聊天 |网络软件 |多媒体类 |系统工具 |图形图像 |系统工具 |应用软件 |行业软件
开发设计类:
|动画制作 |图像处理 |3D设计 |操作系统 |站长学院 |网络相关 |WEB设计 |数据库类 |程序开发
javascript事件处理
作者:佚名    文章来源:网络    点击数:    更新时间:2006-9-20
 

以下的事件可由 JavaScript 发生:

  • onBlur
  • onChange
  • onClick
  • onFocus
  • onLoad
  • onMouseOver
  • onSelect
  • onSubmit
  • onUnload

    onBlur event handler

    A blur event occurs when a text or textArea field on a form loses focus. The onBlur event handler executes JavaScript code when a blur event occurs.

    Applies to

    selection, text, textArea

    Examples

    xxx Examples to be supplied.


    onChange event handler

    A change event occurs when a selection, text, or textArea field loses focus and its value has been modified. The onChange event handler executes JavaScript code when a change event occurs.

    Use the onChange event handler to validate data after it is modified by a user.

    Applies to

    selection, text, textArea

    Examples

    xxx Examples to be supplied.


    onClick event handler

    For button or radioButton, JavaScript code to run when a button is clicked. For checkbox, JavaScript code to run when user checks or unchecks an item.

    Applies to

    button, checkbox, radioButton, link, reset, submit

    Examples

    For example, suppose you have created a JavaScript function called compute(). You can execute the compute() function when the user clicks a button by calling the function in the onClick event handler, as follows:

    <INPUT TYPE="button" VALUE="Calculate" onClick="compute(this.form)">

    In the above example, the keyword this refers to the current object; in this case, the Calculate button. The construct this.form refers to the form containing the button.

    For another example, suppose you have created a JavaScript function called pickRandomURL() that lets you select a URL at random. You can use the onClick event handler of an anchor to dynamically specify a value for the HREF attribute of the anchor, as shown in the following example:

    <A HREF="" onClick="this.href=pickRandomURL();" onMouseOver="window.status='Pick a random URL'; return true"> Go!</A>

    In the above example, the onMouseOver event handler specifies a custom message for the Navigator status bar when the user places the mouse pointer over the Go! anchor. As this example shows, you must return true to set the window.status property in the onMouseOver event handler.


    onFocus event handler

    Executed when input focus enters the field, either by tabbing in or by clicking but not selecting in the field.

    Applies to

    selection, text, textArea

    Examples

    xxx Examples to be supplied.

  • [1] [2] 下一页


  • 上一篇文章:

  • 下一篇文章:
  • 相关文章