KimhillZhang  

使用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>

posted on 2013-04-20 10:39  KimhillZhang  阅读(3996)  评论(0编辑  收藏  举报