这个是javascript的写法

<img src="res/img/shop-c_32.jpg" alt="" onmouseover="this.src='res/img/shop-c_29.jpg';" onmouseout="this.src='res/img/shop-c_32.jpg';">

这是个jquery的写法

<img src="res/img/shop-c_32.jpg" data-back="res/img/shop-c_29.jpg">

再加上jquery的效果写法

<script>
$("img[data-back]").hover(function(){
$(this).data('fallback',$(this).attr('src'));
$(this).attr('src',$(this).data('back'));
},function(){
$(this).attr('src',$(this).data('fallback'));
}); </script>

我比较倾向于后者的写法。那大家觉得呢?

最新文章

  1. rhel 7.0 配置centos yum源(2016/12/8),成功!
  2. JavaScript 深入了解基本类型和引用类型的值
  3. 简单的DropDownButton(Winform)
  4. linux 定时清理session
  5. bpl 包的编写和引用
  6. POJ 3461 裸的KMP
  7. iOS web与js的简单交互
  8. gis论坛
  9. information_schema.collation_character_set_applicability 学习
  10. scrapy pipelines导出各种格式
  11. golang-http-post
  12. [C++]2-5 分数化小数
  13. MyBatis 源码分析 - 配置文件解析过程
  14. JavaSE-关键字final
  15. go自动补全
  16. (22)bootstrap 初识 + Font Awesome(字体图标库)
  17. pig—WordCount analysis
  18. Redis 基础操作
  19. 关于Socket和ServerSocket类详解
  20. 通过mongodump和mongorestore实现Mongodb备份和恢复

热门文章

  1. PL/0编译程序
  2. android greendao3.0 多表关联关系讲解(转)
  3. mysql海量数据条件删除
  4. Spring MVC的视图解析器
  5. wcf读取message内容
  6. css3 transition效果
  7. python爬虫之Selenium
  8. PHP网站在Linux服务器上面的安全配置
  9. mysql 5.5 安装配置方法图文教程(转发)
  10. 11.2.3 Redis的启动停止