Take a look at the example below. Hope this will help you work it out.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="play music">
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<title>Play music
<SCRIPT language=JavaScript type=text/javascript>
<!--
function StartPlay (){
document.track.Play()
}
function StopPlay(){
document.track.Stop()
}
// -->
</script>
</head>
<body >
<EMBED SRC="your_song.wav" name="track" autostart="false" hidden="true" loop="true"> </EMBED>
<input type="button" onclick="StopPlay()" value="Stop">
<input type="button" onclick="StartPlay()" value="Play">
</body>
</html>
Note: To make it work, you still need any version of Windows Media Player to be installed in your computer, else a plug-in error will occurred.
0 comments:
Post a Comment