Also, if anyone could give me an alternative for the <bgsound> tag for playing music it would be greatly appreciated. Here's the script:
Code:
<html>
<head>
<bgsound id="sound">
<script type="text/javascript">
var i = 0
var stringedData = ""
var record = new Array
function add() {
var ext = data.value.substring(data.value.length-4,data.value.length)
if (ext == ".mp3" || ext == ".wav") {
i = i + 1
record.push(data.value)
var space = "<br>"
if (i == 1) {
space = ""
}
else {
space = "<br>"
}
strData()
var html = space+"<a href=\"#\" title=\"play "+stringedData+"\" onclick=\"play(this)\">"+i+". "+stringedData+"</a>"
var store1 = document.getElementById("store")
store1.innerHTML += html
}
else {
alert("Invalid music file. Data may be corrupted.")
}
}
function strData() {
for (x = 0;x < data.value.length;x++) {
if (data.value.charAt(x) == "\\") {
stringedData = data.value.substring(x+1,data.value.length)
}
}
}
function play(id) {
document.getElementById("sound").src = record[id.innerText.substring(0,1)-1]
id.className = "hilite"
id.style.color = "white"
id.onblur = function() {
player.onclick = function() {
id.className = "lolite"
id.style.color = "black"
}
}
showplaying()
}
function stop() {
document.getElementById("sound").src = ""
}
function showplaying() {
nowplaying.innerHTML = "Now Playing: " + stringedData
}
</script>
<style type="text/css">
...
</style>
</head>
<body>
<div id="player">
<img src="header.png" style="float:left"><div style="float:left;font:11px verdana" id="nowplaying"></div>
<br>
<input type="file" id="data">
<input type="button" id="confirm" value="Add to Playlist" onclick="add()">
<div id="store">
<div id="header">playlist</div>
</div>
<div id="outer">
<a href="#" onclick="stop()">[stop]</a>
</div>
</div>
</body>
</html>
Bookmarks