배열에 지정된 이미지들이 랜덤으로 보여집니다
페이지 정보
작성자 서방님 댓글 0건 조회 253회 작성일 07-07-11 17:45본문
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="expires" content="-1">
<meta http-equiv="pragma" content="no-cache">
<title> jasko sample script </title>
<style>
<!--
body,td{font-size:10pt}
//-->
</style>
</head>
<body>
<!---- 아래의 방법으로 <BODY> 와 <BODY> 태그 사이에 붙여 넣으세요 --->
<script language="javascript">
var delay=2000 // 이미지간의 지연시간을 설정 하세요 (1000=1초)
var curindex=0
var randomimages=new Array()
// 랜덤으로 보여줄 이미지들을 설정 하세요
randomimages[0]="http://tong.nate.com/images/invite/nateonevent/send_friend_ic.gif"
randomimages[1]="http://tong.nate.com/images/mytong/icon_tongmenu_purpletong.gif"
randomimages[2]="http://tong.nate.com/images/mytong/post/icon_heart.gif"
randomimages[3]="http://tong.nate.com/images/mytong/tonglevel1.gif"
randomimages[4]="http://tong.nate.com/images/hottong/icon_best.gif"
randomimages[5]="http://tong.nate.com/images/library/icon/ic_rss.gif"
var preload=new Array()
for (n=0;n<randomimages.length;n++)
{
preload[n]=new Image()
preload[n].src="randomimages[n]
}
document.write('<img name="defaultimage" src="'+randomimages[Math.floor(Math.random()*(randomimages.length))]+'">')
function rotateimage()
{
if (curindex==(tempindex=Math.floor(Math.random()*(randomimages.length)))){
curindex=curindex==0? 1 : curindex-1
}
else
curindex=tempindex
document.images.defaultimage.src="randomimages[curindex]
}
setInterval("rotateimage()",delay)
</script>
<p>이미지들이 2초마다 랜덤으로 바뀝니다</p>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.