View Full Version : Random Song Script
alicebilly
06-11-2005, 10:37 PM
does anybody know a random song script that refreshes the page by itsrelf when the song is finished playing?
_Aerospace_Eng_
06-12-2005, 12:25 AM
Here you go.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
text-align:center;
}
-->
</style>
<script type="text/javascript">
<!--
nummp3 = 10
day = new Date()
z = day.getTime()
y = (z - (parseInt(z/1000,10) * 1000))/10
x = parseInt(y/100*nummp3,10) + 1
if (x == (1))
mp3=("song1.mp3")
time=200;
if (x == (2))
mp3=("song2.mp3")
time=300;
if (x == (3))
mp3=("song3.mp3")
time=100;
if (x == (4))
mp3=("song4.mp3")
time=500;
if (x == (5))
mp3=("song5.mp3")
time=700;
if (x == (6))
mp3=("song6.mp3")
time=800;
if (x == (7))
mp3=("song7.mp3")
time=900;
if (x == (8))
mp3=("song8.mp3")
time=1000;
if (x == (9))
mp3=("song9.mp3")
time=100;
if (x == (10))
mp3=("song10.mp3")
time=400;
function refreshme(){
window.location=this.location;
}
//-->
</script>
</head>
<body>
<span id="music1">
<script type="text/javascript">
<!--
document.write('<object id="mediaPlayer" width="270" height="45" '
+'classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" '
+'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" '
+'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'
+'<param name="fileName" value="'+mp3+'">'
+'<param name="autoStart" value="true">'
+'<param name="showControls" value="true">'
+'<param name="loop" value="true">'
+'<embed type="application/x-mplayer2" '
+'pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" '
+'showcontrols="true" width="270" height="45" '
+'src="'+mp3+'" autostart="true" loop="true">'
+'</object>');
setTimeout("refreshme()",time);
//-->
</script>
</span>
</body>
</html>
You will have to account for download times as well. You will need to know the length of each song. 1000 = 1 second.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.