인터넷정보

접속할때마다 배경이미지 랜덤 바꾸기

알 수 없는 사용자 2007. 10. 17. 18:11
<script>

/* This is my random background changer you may use this
freely just as long as you leave this comment in the code

This script was written by William (WILDOG) DuPree
Website: <a href=http://www.bayside.net/users/wildog target=_blank>http://www.bayside.net/users/wildog</a>
e-mail:  <a href=mailto:wildog@bayside.net>wildog@bayside.net</a>

I have other scripts that can be found iether on my page or at
www.javascripts.com  

HAVE FUN!!   :-)*/

var bg = new Array(9)
bg[0] = "http://korea.internet.com/images/nid_image/010503_bg01.gif"  
bg[1] = "http://korea.internet.com/images/nid_image/010503_bg02.gif"  
bg[2] = "http://korea.internet.com/images/nid_image/010503_bg03.gif"  
bg[3] = "http://korea.internet.com/images/nid_image/010503_bg04.gif"  
bg[4] = "http://korea.internet.com/images/nid_image/010503_bg05.gif"  
bg[5] = "http://korea.internet.com/images/nid_image/010503_bg06.gif"  
bg[6] = "http://korea.internet.com/images/nid_image/010503_bg07.gif"  
bg[7] = "http://korea.internet.com/images/nid_image/010503_bg08.gif"  
bg[8] = "http://korea.internet.com/images/nid_image/010503_bg09.gif"  

var now = new Date()
var sec = now.getSeconds()

document.write("<body background="+bg[sec % 9]+" text='b22222' link='000000' vlink='0000aa'>")
</script>

이걸 조금만 응용하면 이미지 주소대신 음악주소를 넣구...
embed 태그를 사용해서 랜덤으로 음악을 뿌려줄 수 있겠죠.

반응형