js播放wav文件(源码)
用js播放.wav文件
js播放wav文件
代码如下:
<html> <head> <script language="javascript"> function playSound(id) { var node=document.getElementById(id); if(node!=null) { node.Play(); } } </script> </head> <body> <embed name="3_devUnknown" id="3_devUnknown" src="music.wav" type="audio/x-wav" hidden="true" autostart="false" loop="false"/><a onclick="javascript:playSound('3_devUnknown')" href="#">music.wav</embed/> </body> </hmtl> var recordhisStore = new Ext.data.JsonStore({ root: 'dataRoot', totalProperty: 'totalCount', idProperty: 'threadid', remoteSort: true, fields: [ {name: 'id', type: 'string'}, {name: 'src', type: 'string'}, {name: 'dst', type: 'string'}, {name: 'srcip', type: 'string'}, {name: 'dstip', type: 'string'}, {name: 'begin_date', type: 'date', dateFormat:'Y-m-d H:i:s'},//onclick='javascript:startwav(\" "+ value +" \")' {name: 'end_date', type: 'date', dateFormat:'Y-m-d H:i:s'}, {name: 'content', type: 'string', convert:function(value,rec){ return "<embed id='"+ rec.id +"_devUnknown' name='"+ rec.id +"_devUnknown' src='music.wav' loop=false autostart=false hidden=true><a href='#' onclick=\"javascript:playSound('"+rec.id+"_devUnknown')\">"+value+"</a></embed>"; }} ], proxy: new Ext.data.HttpProxy({ url: 'ctl.php?c=HisRecordQueryController&a=Query' }), sortInfo: {field: 'begin_date', direction: 'ASC'}, listeners:{ beforeload:function(obj,params){ var begin_date = document.getElementById("his_startdt").value; var end_date = document.getElementById("his_enddt").value; var src = document.getElementById("his_src").value; var dst = document.getElementById("his_dst").value; recordhisStore.baseParams = {limit:params.params.limit,start:params.params.start,begindate:begin_date,enddate:end_date,src:src,dst:dst}; } } });
js播放wav文件
代码如下:
使用js,每隔1s播放对应的wav文件 <script language="javascript"> var arr = new Array(); var c = 0; window.onload = function () { var value1 = '<%=tel_2 %>'; var value2 = '<%=je %>' StrToArray(value1); StrToArray(value2); } var StrToArray = function (str) { for (var i = 0; i < str.length; i++) { arr[arr.length] = str.charAt(i); } } var id = window.setInterval(function () { if (c > arr.length) { window.clearInterval(id); //清除 return; } embed(arr[c++]); }, 1000); var embed = function (num) { if (num == "" || typeof num == "undefined") return; document.getElementById("embed").innerHTML = "<embed name=\"player\" TYPE=\"application/x-mplayer2\" src=\"../wav/" + num + ".wav\" loop=\"false\" autostart=\"true\" hidden=\"true\"></embed>"; } </script>
相关推荐
88274956 2020-11-03
runner 2020-09-01
梦的天空 2020-08-25
移动开发与培训 2020-08-16
ReunionIsland 2020-08-16
lyqdanang 2020-08-16
MyNameIsXiaoLai 2020-07-08
星辰的笔记 2020-07-04
csstpeixun 2020-06-28
letheashura 2020-06-26
liaoxuewu 2020-06-26
sunzhihaofuture 2020-06-21
FEvivi 2020-06-16
坚持着执着 2020-06-16
waterv 2020-06-14
xiaoge00 2020-06-14
firejq 2020-06-14
firstboy0 2020-06-14
e度空间 2020-06-12
zhongweinan 2020-06-10