PDA

View Full Version : listen or download


ahmedsoliman
01-27-2003, 12:44 AM
i have mp3 library in my site , and i want to give user two options (listen or download), if dowload the code will be
<a href="http://www.mysite/sounlib/music1.mp3">music1</a>
what is the code that will open mediaplayer to play the file

relyt
01-27-2003, 12:56 AM
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_controlSound(x, _sndObj, sndFile) { //v3.0
var i, method = "", sndObj = eval(_sndObj);
if (sndObj != null) {
if (navigator.appName == 'Netscape') method = "play";
else {
if (window.MM_WMP == null) {
window.MM_WMP = false;
for(i in sndObj) if (i == "ActiveMovie") {
window.MM_WMP = true; break;
} }
if (window.MM_WMP) method = "play";
else if (sndObj.FileName) method = "run";
} }
if (method) eval(_sndObj+"."+method+"()");
else window.location = sndFile;
}
//-->
</script>
</head>

<body bgcolor="#FFFFFF" onLoad="MM_controlSound('play','document.CS1043639700010','http://www.mysite/sounlib/music1.mp3')">
<EMBED NAME='CS1043639700010' SRC='http://www.mysite/sounlib/music1.mp3' LOOP=false
AUTOSTART=false MASTERSOUND HIDDEN=true WIDTH=0 HEIGHT=0>
</EMBED>
</body>
</html>

ahmedsoliman
01-27-2003, 01:07 AM
thanks relyt, but i found in a site this code:
<a href="http://www.mysite/sounlib/music1.mp3">download</a>
<a href="pnm://www.mysite/sounlib/music1.mp3">listen</a>
they haven't all the code you type, i mean is there easear way to do this.

relyt
01-27-2003, 01:14 AM
k. alls i did was go into Dreamweaver and select "play on load" and typed in the link and thats what it gave me. but the one you found is easier :)

ahmedsoliman
01-27-2003, 01:17 AM
but i my way dosen't work with me, so i asked you if you know it.
i am using iis