×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Multiple MP3 files

Multiple MP3 files

Multiple MP3 files

(OP)
I would like to know how one puts multiple music files on a site where visitors can choose the one the want to listen to. Like a juke box I guess?
Thanks, Boss

RE: Multiple MP3 files

Flash would be probably better in the long run, but you can check out this code

CODE

<!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=windows-1252">

<title>Title here</title>


</head>

<body>

<p align="Center">
<script language="javascript">var streams = new Array();
streams[0] = new makeStream("one.wav", "1...Song Title One");
streams[1] = new makeStream("two.wav", "2...Song Title Two");
streams[2] = new makeStream("three.wav", "3...Song Title Three");
streams[3] = new makeStream("four.wav", "4...Song Title Four");
function makeStream(url, name) {
    this.url = url;
    this.name = name;
}
function handleControlsOnOffClick() {
  if (document.mediaPlayer.showControls == true) {
    document.mediaPlayer.showControls = false;
      document.playerCtrl.controls.value = "  :.SHOW PLAYER.:";
  }
  else {
    document.mediaPlayer.showControls = true;
      document.playerCtrl.controls.value = "  :.HIDE PLAYER.: "
  }}
function handlePlayOrPauseClick(){
  var state;
  playerStatus = document.mediaPlayer.playState;
  if (playerStatus == 6) {
    document.mediaPlayer.play();
    document.playerCtrl.playOrPause.value = " :.PAUSE.: ";
  }
  else if (playerStatus == 1) {
    document.mediaPlayer.play();
    document.playerCtrl.playOrPause.value = " :.PAUSE.: ";
  }
  else if (playerStatus == 2) {
    document.mediaPlayer.pause();
    document.playerCtrl.playOrPause.value = " :.PLAY.:  ";
  }
}
function changeSize(newSize) {
  document.mediaPlayer.displaySize = newSize;
}
function change() {
  var list = document.playerCtrl.streams;
  var streamURL = list.options[list.selectedIndex].value;
  document.mediaPlayer.stop();
  document.playerCtrl.playOrPause.value = " :.PAUSE.: ";
  document.mediaPlayer.fileName = streamURL;
}
</script>

<object id="mediaPlayer" 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" width="239" height="179">
  <param name="fileName" value="sounds/bestieverhad.wav">
  <param name="animationatStart" value="false">
  <param name="transparentatStart" value="true">
  <param name="autoStart" value="true">
  <param name="loop" value="true">
  <param name="showControls" value="false">
</object>

<form name="playerCtrl">
  <input type="button" value=" :.PAUSE.: " name="playOrPause"
  onclick="handlePlayOrPauseClick()" style="font-family:courier"> <input
  type="button" value="  :.SHOW PLAYER.: " name="controls"
  onclick="handleControlsOnOffClick()" style="font-family:courier">

<script language="javascript">
with (document) {
  writeln('<select name="streams" onChange="change()">');
  for (var i = 0; i < streams.length; i++) {
    writeln('<option value="', streams[i].url, '">', streams[i].name);
  }
  writeln('</select>');
}
</script>
</form>
</p>

</body>

</html>

__________________________
Corey

http://www.loudcommerce.com/
http://www.loudcommerce.com/promo/tek.asp

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close