【JavaScript】JS动态给对象添加事件

WEB项目中,我们常常会碰到要动态对相应的对象添加事件,如下,有>

1 <div>

2 <input type="text" name = "txtPrice" value = "0"/>

3 <div>