본문 바로가기

Computer/Etc

랜덤 배경음악 무비 플래쉬 넣는 소스

랜덤 배경음악(무비,플래쉬) 넣는 소스 


<head>와 </head>사이에 코딩 할것

<script language="JavaScript">
<!--
var ads = 3;
var now = new Date()
var sec = now.getSeconds()
var ad = sec % ads;
ad +=1;

if (ad == 1) { banner='http://음악주소'; }
else if (ad == 2) { banner='http://음악주소'; }
else if (ad == 3) { banner='http://음악주소'; }

document.write('<embed type="video/x-ms-asf-plugin" src=\"' + banner + '\" console="Clip1" controls="PositionSlider" autostart=true hidden=true loop="-1">');
//-->
</script>



var ads = 3; <--- 3 곡을 연주(?)하라는 뜻.. 4..5..6..
else if (ad == 3) <--- (ad == 3...4...5...) 추가할때마다 똑같이..
loop="-1"> <--- 반복 횟수 지정 ( -1 = 무한반복 )
만약 뮤직비디오를 플레이 하실려면 hidden=true를 hidden=false로
변경하시거나 또는 hidden=true를 삭제하셔도 됩니다. hidden=true라는 파라미터는
플레이어를 포함하여 콘트롤 버튼까지 모두 감춰 버립니다.
만약 무비는 활성화하면서 콘트롤만 없애길 원하신다면 controller="false"라는
파라미터를 삽입하시면 됩니다. 또, 무비이므로 가로, 세로 크기를 지정하세요.
지정하지 않으면 본래의 크기로 활성화 되어집니다.

만약 플래쉬무비를 적용하신다면 위의 부분중에서 수정하실 부분이 있습니다.


document.write('<embed quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" src=\"' + banner + '\" console="Clip1" controls="PositionSlider" width="크기" height="크기" autostart="true" hidden="false" menu="false">');


한가지 알아 두실 점은 본 소스는 사이트 방문시 임의로 아무거나 무작위로
바꿔서 플레이 해주는 것이지 한곡이 끝나고 다른 곡으로의 연결이 되는 것은 아닙니다.
출처 랜덤 배경음악(무비,플래쉬) 넣는 소스|작성자 하늘형


-------------------------------------------------------------
배경음악 랜덤으로 듣기

1.index.htm
<html>
<head>
<meta http-equiv=content-type content=text/html; charset=euc-kr>
<title></title>
</head>
<frameset rows="*,0" border=0>
<frame src="index2.htm" frameborder=0 scrolling=auto>
</frameset>
</html>

2.index2.htm
<html>
<head>
<title></title>
<SCRIPT LANGUAGE="JavaScript">
<!--
var music = new Array()
music[0] = "소스";
music[1] = "소스";
music[2] = "소스";        //음악이 더 있다면 music[3]... 식으로 계속 추가

var i = Math.round(Math.random() * (music.length - 1));
document.write("<bgsound src = " + music[i] + ">");                //또는 아래의 embed 태그를
//document.write("<embed src = " + music[i] + " hidden = true autostart = true>");
//-->
</SCRIPT>
</head>
<body>
</body>
</html>