what are the “for” and “event” attributes of the script tag (Javascript,HTML)

后端 未结 4 1052
情歌与酒
情歌与酒 2020-12-31 02:26

In a web application I\'ve inherited at work which was written about 10 years ago I\'ve noticed the following code snippets repeatedly used:



        
4条回答
  •  执笔经年
    2020-12-31 03:26

    According to MSDN, the:

    for attribute:

    Sets or retrieves the object that is bound to the event script.

    event attribute:

    Sets or retrieves the event for which the script is written.

    Therefore, I presume as you have that you can drop the non-standard attributes and use the lines you added to get the element, and handle the mousedown event.

提交回复
热议问题