Re:网页中的多媒体播放控制
2.声音及影像播放的控制之二(作者biyun,工兵)
MP3
以下内容为程序代码:
<embed src="mm.mp3" width="147" height="44" AUTOSTART=TRUE></embed>
meidy play能支持的都能放的
鼠标到,声音出,2个示例(以前贴过的)
以下内容为程序代码:
<script language="vbs">
SUB btn1_onmouseover
document.all("bgsoundone").src="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/S/21.mid";
end sub
sub btn1_onmouseout
document.all("bgsoundone").src=""
end sub
SUB btn2_onmouseover
document.all("bgsoundone").src="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/S/11.mid";
end sub
sub btn2_onmouseout
document.all("bgsoundone").src=""
end sub
</script>
<bgsound id=bgsoundone src="" loop=-1>
<A href="#" name=btn1>HERE1</a><br><br>
<A href="#" name=btn2>HERE2</a><EMBED src="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/S/21.mid"; autostart="false" width="0" height="0" ><EMBED src="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/S/11.mid"; autostart="false" width="0" height="0" >
点击什么音源,都在页面固定的“播放器”播放(以rm文件为例)
1.做一个小框架页 代码片段如下:
以下内容为程序代码:
<IFRAME src="http://www.xiakedao.com/biyun/3/0/diangemain.htm"; marginwidth="0" marginheight="0" scrolling="no" frameborder="0" width="50" height="25" name="diange"></IFRAME>
2.这个内嵌框架页 width="72" height="17" ,框架无滚动条,刚好只显示REALPLAY播放器,不会露馅。注意设该框架页的名字。比如这里是diange
3.把以下这段代码放在你设定的框架页里,我这里是http://www.xiakedao.com/biyun/3/0/diangemain.htm页面,最好先把页边距设为0。
<embed height=25 src=http://www.xiakedao.com/biyun/ren/1.rm type=audio/x-pn-realaudio-plugin width=50 autostart="true" controls="PlayButton">
4.这是一个实例
<IFRAME src="http://www.xiakedao.com/biyun/3/0/diangemain.htm"; marginwidth="0" marginheight="0" scrolling="no" frameborder="0" width="50" height="25" name="diange"></IFRAME>
其中http://www.xiakedao.com/biyun/3/0/diangemain.htm的原文件是
<body topmargin="0" leftmargin="0">
<embed height=25 src=http://www.xiakedao.com/biyun/ren/1.rm type=audio/x-pn-realaudio-plugin width=50 autostart="true" controls="PlayButton">
</body>
现在做一个框架页是为了让你点击连接后使RM文件在这个固定的播放器里播出而已。为每一个RM做一个类似diangemain.htm这样的页面,修改其中的声音地址就可以了。注意主页面里的连接要写明 target="diange"(你可以自己设定名字的,不过要与框架页的name="diange"相对应)
控制媒体播放器音量(转贴 )
以下内容为程序代码:
<embed id=mm width=100 height=100 src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/1.mid></embed><br>
<br>
<button onclick=mm.ShowDialog(2)>Option</button>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
</HEAD>
<BODY bgColor=#FFFFFF onload="currentBGM()">
<SCRIPT Language="JavaScript">
<!--
function currentBGM(){
if(bgmpath =="") return;
var obj = document.bgmparent.bgmselect;
for(i=0; i<obj.length; i++) {
var val = obj.options[i].value;
if(val == bgmpath) { obj.options[i].selected = true;}
}
}
function bgmselecter(obj) {
query= obj.options[obj.selectedIndex].value;
if(query != "") {
url = ((location.href).indexOf("?") != -1)
? (location.href).substring(0, (location.href).indexOf("?"))
: (location.href);
location.href = url +"?"+ query;
}
}
var bgmpath = ""; //"..."偺拞偵堦夞栚傾僋僙僗帪偺壒妝僼傽僀儖傊偺僷僗傪彂偗傞丅
if(location.search != ("" || "?")) {
var chrat = location.search.indexOf("?");
bgmpath = location.search.substring(chrat+1, location.search.length);
}
if(bgmpath !="") {
document.write("<bgsound src='" +bgmpath+ "' loop='infinite'>");
if(navigator.appName.indexOf("Netscape") != -1) {
document.write("<EMBED SRC='" +bgmpath+ "' WIDTH=0 HEIGHT=0 PANEL=0 AUTOSTART=TRUE REPEAT=TRUE>");
}
}
//-->
</SCRIPT>
<center>
<form mathod="post" name="bgmparent">
<select name="bgmselect" onChange="bgmselecter(this)">
<option value="">--SELECT BGM--
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/1.mid";>BGM1
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/2.mid";>BGM2
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/3.mid";>BGM3
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/4.mid";>BGM4
</select>
</form>
</center>
</BODY>
</HTML>
下拉菜单控制音乐出(无播放器)
以下内容为程序代码:
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Shift_JIS">
</HEAD>
<BODY bgColor=#FFFFFF onload="currentBGM()">
<SCRIPT Language="JavaScript">
<!--
function currentBGM(){
if(bgmpath =="") return;
var obj = document.bgmparent.bgmselect;
for(i=0; i<obj.length; i++) {
var val = obj.options[i].value;
if(val == bgmpath) { obj.options[i].selected = true;}
}
}
function bgmselecter(obj) {
query= obj.options[obj.selectedIndex].value;
if(query != "") {
url = ((location.href).indexOf("?") != -1)
? (location.href).substring(0, (location.href).indexOf("?"))
: (location.href);
location.href = url +"?"+ query;
}
}
var bgmpath = ""; //"..."偺拞偵堦夞栚傾僋僙僗帪偺壒妝僼傽僀儖傊偺僷僗傪彂偗傞丅
if(location.search != ("" || "?")) {
var chrat = location.search.indexOf("?");
bgmpath = location.search.substring(chrat+1, location.search.length);
}
if(bgmpath !="") {
document.write("<bgsound src='" +bgmpath+ "' loop='infinite'>");
if(navigator.appName.indexOf("Netscape") != -1) {
document.write("<EMBED SRC='" +bgmpath+ "' WIDTH=0 HEIGHT=0 PANEL=0 AUTOSTART=TRUE REPEAT=TRUE>");
}
}
//-->
</SCRIPT>
<center>
<form mathod="post" name="bgmparent">
<select name="bgmselect" onChange="bgmselecter(this)">
<option value="">--SELECT BGM--
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/1.mid";>BGM1
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/2.mid";>BGM2
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/3.mid";>BGM3
<option value="http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/4.mid";>BGM4
</select>
</form>
</center>
</BODY>
</HTML>
31天不同 的音乐(转贴)
以下内容为程序代码:
<SCRIPT LANGUAGE="JavaScript">
<!-- hiding
page=new Date();
if (page.getDate() == 1)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/1.mid width=145 height=40 autostart=true loop=-1 volume=50>");
//曲目自己随便定,可用http://绝对路径表示,本例使用相对路径.//
//loop=-1表示循环播放,autostart=true表示自动播放,false表示手动播放//
if (page.getDate() == 2)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/2.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 3)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/3.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 4)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/4.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 5)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/5.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 6)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/6.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 7)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/7.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 8)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/8.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 9)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/9.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 10)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/10.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 11)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/11.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 12)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/12.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 13)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/13.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 14)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/14.midwidth=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 15)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/15.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 16)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/16.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 17)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/17.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 18)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/18.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 19)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/19.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 20)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/20.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 21)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/21.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 22)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/22.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 23)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/23.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 24)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/24.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 25)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/25.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 26)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/26.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 27)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/27.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 28)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/28.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 29)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/29.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 30)
document.write("<embed src=http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/30.mid width=145 height=40 autostart=true loop=-1 volume=50>");
if (page.getDate() == 31)
document.write("<embed src=x-http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/31.midwidth=145 ;height=40 autostart=true loop=-1 volume=50>");
page=new Date();
var months = new Array(13);
months[1] = "1月";
months[2] = "2月";
months[3] = "3月";
months[4] = "4月";
months[5] = "5月";
months[6] = "6月";
months[7] = "7月";
months[8] = "8月";
months[9] = "9月";
months[10] = "10月";
months[11] = "11月";
months[12] = "12月";
var dateObj = new Date()
var lmonth = months[dateObj.getMonth() + 1]
var date = dateObj.getDate()
document.write("<br>" +"今天是:"+ lmonth + date+"日")
//done hiding -->
</SCRIPT>
midi音乐随机出(有播放器)
以下内容为程序代码:
<script>
<!--
var nummidi = 6
day = new Date()
seed = day.getTime()
ran = parseInt(((seed - (parseInt(seed/1000,10) * 1000))/10)/100*nummidi + 1,10)
if (ran == (1)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/1.mid";)
if (ran == (2)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/2.mid";)
if (ran == (3)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/3.mid";)
if (ran == (4)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/4.mid";)
if (ran == (5)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/5.mid";)
if (ran == (6)) midi=("http://www.shunde.net.cn/~biyun/wlsd/wy/yinyue/H/6.mid";)
document.write('<EMBED SRC= "' + midi + '" volume=100 controls=smallconsole loop=true HSPACE=3 WIDTH=48 HEIGHT=26 AUTOSTART=TRUE>')
// -->
</script>
当WIDTH=48 HEIGHT=26 都为0时,可以隐藏播放器<INPUT onclick=history.go(0) type=button value=刷新看效果>
浏览本机音源播出(以前这里的旧贴)
以下内容为程序代码:
<script lanuage="JavaScript">
function playMedia(frm){
fn = document.forms["frmMedia"].elements["fnMedia"].value;
openMedia(fn);
}
function openMedia(fn)
{
newWin="";
newWin = window.open("", "k12Media", "");
newWin.document.close();
// <head>....</head>
newWin.document.writeln("<html>");
newWin.document.writeln("<head>");
newWin.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>");
newWin.document.writeln("<title>正在播放文件:[" + fn + "]</title>");
newWin.document.writeln("</head>");
// <body>
newWin.document.writeln("<body><p>");
newWin.document.writeln("<b><font color=#808080 size=2>文件:" + fn + "</font></b><br>");
newWin.document.writeln("<object classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' id='MediaPlayer1' width='286' height='225'>");
newWin.document.writeln("<param name='AudioStream' value='-1'>");
newWin.document.writeln("<param name='AutoSize' value='-1'>");
newWin.document.writeln("<param name='AutoStart' value='1'>");
newWin.document.writeln("<param name='AnimationAtStart' value='-1'>");
newWin.document.writeln("<param name='AllowScan' value='-1'>");
newWin.document.writeln("<param name='AllowChangeDisplaySize' value='-1'>");
newWin.document.writeln("<param name='AutoRewind' value='0'>");
newWin.document.writeln("<param name='Balance' value='0'>");
newWin.document.writeln("<param name='BaseURL' value=>");
newWin.document.writeln("<param name='BufferingTime' value='5'>");
newWin.document.writeln("<param name='CaptioningID' value>");
newWin.document.writeln("<param name='ClickToPlay' value='-1'>");
newWin.document.writeln("<param name='CursorType' value='0'>");
newWin.document.writeln("<param name='CurrentPosition' value='-1'>");
newWin.document.writeln("<param name='CurrentMarker' value='0'>");
newWin.document.writeln("<param name='DefaultFrame' value>");
newWin.document.writeln("<param name='DisplayBackColor' value='0'>");
newWin.document.writeln("<param name='DisplayForeColor' value='16777215'>");
newWin.document.writeln("<param name='DisplayMode' value='0'>");
newWin.document.writeln("<param name='DisplaySize' value='0'>");
newWin.document.writeln("<param name='Enabled' value='-1'>");
newWin.document.writeln("<param name='EnableContextMenu' value='-1'>");
newWin.document.writeln("<param name='EnablePositionControls' value='-1'>");
newWin.document.writeln("<param name='EnableFullScreenControls' value='0'>");
newWin.document.writeln("<param name='EnableTracker' value='-1'>");
newWin.document.writeln("<param name='Filename' value='" + fn + "'>");
newWin.document.writeln("<param name='InvokeURLs' value='-1'>");
newWin.document.writeln("<param name='Language' value='-1'>");
newWin.document.writeln("<param name='Language' value='-1'>");
newWin.document.writeln("<param name='Language' value='-1'>");
newWin.document.writeln("<param name='PlayCount' value='1'>");
newWin.document.writeln("<param name='PreviewMode' value='1'>");
newWin.document.writeln("<param name='Rate' value='1'>");
newWin.document.writeln("<param name='SAMILang' value>");
newWin.document.writeln("<param name='SAMIStyle' value>");
newWin.document.writeln("<param name='SAMIFileName' value>");
newWin.document.writeln("<param name='SelectionStart' value='-1'>");
newWin.document.writeln("<param name='SelectionEnd' value='-1'>");
newWin.document.writeln("<param name='SendOpenStateChangeEvents' value='-1'>");
newWin.document.writeln("<param name='SendWarningEvents' value='-1'>");
newWin.document.writeln("<param name='SendErrorEvents' value='-1'>");
newWin.document.writeln("<param name='SendKeyboardEvents' value='0'>");
newWin.document.writeln("<param name='SendMouseClickEvents' value='0'>");
newWin.document.writeln("<param name='SendMouseMoveEvents' value='0'>");
newWin.document.writeln("<param name='SendPlayStateChangeEvents' value='-1'>");
newWin.document.writeln("<param name='ShowCaptioning' value='0'>");
newWin.document.writeln("<param name='ShowControls' value='-1'>");
newWin.document.writeln("<param name='ShowAudioControls' value='-1'>");
newWin.document.writeln("<param name='ShowDisplay' value='0'>");
newWin.document.writeln("<param name='ShowGotoBar' value='0'>");
newWin.document.writeln("<param name='ShowPositionControls' value='-1'>");
newWin.document.writeln("<param name='ShowStatusBar' value='0'>");
newWin.document.writeln("<param name='ShowTracker' value='-1'>");
newWin.document.writeln("<param name='TransparentAtStart' value='0'>");
newWin.document.writeln("<param name='VideoBorderWidth' value='0'>");
newWin.document.writeln("<param name='VideoBorderWidth' value='0'>");
newWin.document.writeln("<param name='VideoBorderColor' value='0'>");
newWin.document.writeln("<param name='VideoBorder3D' value='0'>");
newWin.document.writeln("<param name='Volume' value='-600'>");
newWin.document.writeln("<param name='WindowlessVideo' value='0'>");
newWin.document.writeln("</object>");
newWin.document.writeln("</p>");
newWin.document.writeln("</body></html>");
}
</script><form name="frmMedia">
<p align="center"><input type="file" name="fnMedia" size="20"><br>
<input type="button" value="播 放" name="B1" onclick="playMedia(this.form);"><input type="reset" value="重 置" name="B2"></p>
</form>