jquery code (IE compatible, Firefox plug-in, Google Chrome compatible, opera did not respond)
The code is as follows |
Copy Code |
$ (function () { $ (' A.button '). Click (function () { $ (' embed '). Remove (); $ (' body '). Append (' <embed src= "Button.wav" autostart= "true" hidden= "true" loop= "false" > "); }); }); |
Method Two
code is as follows |
copy code |
<div id= "Div1" ></div> <input type= "button" value= "immediately" onclick= "Play_click" (This, ' http://www.xxx. Cc/1.wav '); " <div id= "Div2" ></div> <script language= "javascript" function Play_click (sef,url) { var div = document.getElementById (' Div1 '); div.innerhtml = ' <embed src= ' +url+ ' loop= ' 0 ' autostart= ' true ' hidden= ' true ' ></embed> '; var emb = document.getelementsbytagname (' EMBED ') [0]; if (EMB) { /* can be written here to determine whether the WAV file has been loaded, the following is modeled with a settimeout */ div = document.getElementById (' div2 '); Div.i nnerhtml = ' loading: ' +emb.src; Sef.disabled = true; settimeout (function () {div.innerhtml= ';},1000); } </script> |