Js player wav Files (source code)

Source: Internet
Author: User

Use a js).wav File
Copy codeThe Code is as follows:
<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: 'datarot ',
TotalProperty: 'totalcount ',
IdProperty: 'threadid ',
RemoteSort: true,
Fields :[
{Name: 'id', type: 'string '},
{Name: 'src', type: 'string '},
{Name: 'dst ', type: 'string '},
{Name: 'srcip ', type: 'string '},
{Name: 'dstamp', type: 'string '},
{Name: 'In in _ 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: 'In in _ date', ction: '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 player wav Files
Copy codeThe Code is as follows:
Use js to play the corresponding wav file every 1 s
<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); // clear
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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.