码迷,mamicode.com
首页 > 其他好文 > 详细

点击图片切换随机图片?

时间:2014-12-08 17:41:22      阅读:150      评论:0      收藏:0      [点我收藏+]

标签:io   ar   on   div   cti   ad   html   as   tt   

$(function(){
var strAlt=$("img").attr("title");
strAlt +="<br/><br/>"+$("img").attr("src");
$("divAlt").html(strAlt);


})

随机图片
$(function(){
$("img").attr("src".function(){
return "images/img0"+Math.floor(Math.random()*2+1)+".jpg"
});
$("img").attr("title","这是一幅风景画");
$("img").addClass("clsImg");

})

点击图片切换随机图片?

标签:io   ar   on   div   cti   ad   html   as   tt   

原文地址:http://www.cnblogs.com/jiechn/p/4151446.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!