根据事件类型做出反应
2017-06-02 23:19
239 查看
window.onload=function(){ var box=document.getElementById("box"); function thingstype(ev){ var e=ev||event; switch(e.type){ case'click':e.target.style.background='blue';break; case'mouseenter':e.target.style.background='green';break; case'mouseleave':e.target.style.background='yellow';break; } } box.onclick=function(){ thingstype(); } }
好像这么玩 用处不大...
相关文章推荐
- trigger 根据绑定到匹配元素的给定的事件类型执行所有的处理程序和行为。
- JavaScript入门之document.write,对事件做出反应onclick
- TaskTriggerType 根据事件类型来确定节点
- .Net 事件类型的实现和推荐做法
- Observer 在对象之间定义一个一对多的依赖关系,从而当一个对象状态发生改变时,所有依赖于这个对象的对象都能够得到通知,并对上述改变做出反应.
- 获取表结构并根据字段类型填充到下拉框
- 根据判断浏览器类型屏幕分辨率自动调用不同CSS的代码
- 判断文件类型(文件的真正类型,不是根据扩展名判断),通过文件头来判断
- 根据文件类型分别上传到各自的目录中
- string类型的初值不是随便赋的,记一次奇怪的访问冲突事件
- 肯德基必须对“垃圾事件”做出答复!
- C#能否象JAVA那样根据类名建立Class类型的对象
- C# 2005如何根据类型声明的字符串反射创建泛型(Generic)对象
- MM--移动类型的配置相关的系统表,举例说明SAP是如何根据配置抛帐的
- XML:根据浏览器类型屏幕分辨率自动调用不同CSS的代码
- 根据返回值类型重载函数
- 地震事件中,北京政府网站反应速度堪忧
- MSSQL根据数据库字段类型判断存储过程参数类型
- 自定义事件类型
- MM--移动类型的配置相关的系统表,举例说明SAP是如何根据配置抛帐的