jQuery 랜덤 이미지 스크립트
랜덤 이미지 스크립트
예제1
예제2
예제1
function randomImage(){
var bannerImages=new Array();
bannerImages[0]="/img/bns_banner_0910.jpg";
bannerImages[1]="/img/bns_banner_1107.jpg";
bannerImages[2]="/img/bns_banner_1112.jpg";
var bannerlink = new Array();
bannerlink[0] = "http://silverfang.zc.bz";
bannerlink[1] = "http://silverfang.zc.bz";
bannerlink[2] = "http://silverfang.zc.bz";
var bannerTitle = new Array();
bannerTitle[0] = "";
bannerTitle[1] = "";
bannerTitle[2] = "";
var bannerAlt = new Array();
bannerAlt[0] = "";
bannerAlt[1] = "";
bannerAlt[2] = "";
var ranNum=Math.floor(Math.random()*bannerImages.length);
$('#ad2 img').attr({src : bannerImages[ranNum],
alt: bannerAlt[ranNum]});
$('#ad2 a').attr({href : bannerlink[ranNum],
title: bannerTitle[ranNum]});
}
randomImage();
//randomImage
var bannerImages=new Array();
bannerImages[0]="/img/bns_banner_0910.jpg";
bannerImages[1]="/img/bns_banner_1107.jpg";
bannerImages[2]="/img/bns_banner_1112.jpg";
var bannerlink = new Array();
bannerlink[0] = "http://silverfang.zc.bz";
bannerlink[1] = "http://silverfang.zc.bz";
bannerlink[2] = "http://silverfang.zc.bz";
var bannerTitle = new Array();
bannerTitle[0] = "";
bannerTitle[1] = "";
bannerTitle[2] = "";
var bannerAlt = new Array();
bannerAlt[0] = "";
bannerAlt[1] = "";
bannerAlt[2] = "";
var ranNum=Math.floor(Math.random()*bannerImages.length);
$('#ad2 img').attr({src : bannerImages[ranNum],
alt: bannerAlt[ranNum]});
$('#ad2 a').attr({href : bannerlink[ranNum],
title: bannerTitle[ranNum]});
}
randomImage();
//randomImage
예제2
var bannerImages=["/img/bns_banner_0910.jpg", "/img/bns_banner_1107.jpg", "/img/bns_banner_1112.jpg"],
bannerlink = ["http://silverfang.zc.bz", "http://silverfang.zc.bz", "http://silverfang.zc.bz"],
bannerTitle = ["", "", ""],
bannerAlt = ["", "", ""];
bannerlink = ["http://silverfang.zc.bz", "http://silverfang.zc.bz", "http://silverfang.zc.bz"],
bannerTitle = ["", "", ""],
bannerAlt = ["", "", ""];
jQuery 랜덤 이미지 스크립트
Reviewed by jieun
on
오후 5:42
Rating:
댓글 없음: