How to play a sound in jsp?

Category: Web Develop
 
qhhcwx
2009-12-19 10:38:00

Sponsored Links
Brother recently with the development of a monitoring and management system jsp, customer requirements in the monitor refresh display a jsp page (jsp page from the background of the real-time fault data sheet timing extraction latest fault records), if there is a new fault record is extracted to, In addition to requiring the monitoring page displays the fault record things, play a sound alarm notification requirement, similar to the currently popular on the forum "You have a new message, please note that check" function.
urge Which master gets advice, it is best to give example code here Xianxie brother!

Sponsored Links

ppmy800102
2009-12-19 10:43:19
Recommended given time to refresh the page using XMLHTTP request background database
<% @ page contentType = "text / html; charset = GBK"%>
< Script language = "javascript">
var interval_id = setInterval ("GetNewMsg ('<% = sUserID%>')", 10000)

function smstip (SmsID)
{
if (parent.topFrame.smg)
{
parent.topFrame.smg.innerHTML = "<a style = 'cursor: hand 'onclick = \ "popsms ('" + SmsID + "') \"> <img src =' / Images/tophead/style1/newsms.gif 'alt =' You there is a short message 'border = 0> </a> ";
}
}
function GetNewMsg (sUserID)
{
;/ / get a user if there is a new message, if the XML return message ID, you prompt and switch the picture.
try {
var oXMLDoc = new ActiveXObject ('MSXML');
sURL = 'XMLMsg. jsp? sUserID = '+ sUserID;
oXMLDoc.url = sURL;
var oRoot = oXMLDoc.root;
if (oRoot.children! = null)
{
for (var i = 0; i <oRoot. children.length; + + i)
{
oItem = oRoot.children.item (i);
sName = oItem.children.item (0). text ;
/ / voice prompts
; document.all.bgs.src = "/ sound / progctor.wav";
smstip (sName)
}

}
} catch (err) {

alert ("server is unavailable, please re-login Try! ");
}
}
</script>
<bgsound id = bgs src =" " loop = 1>
jintao4530
2009-12-19 10:55:54
<BGSOUND balance=0 loop=-1 src="sound/love.mid" volume=0>
lisalee_css
2009-12-19 11:14:24
thank two man's reply
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.