/*
JavaScript Unleashed, Third Edition
by Richard Wagner and R. Allen Wyke
ISBN: 067231763X
Publisher Sams CopyRight 2000
*/
<html>
<head>
<title>JavaScript Unleashed</title>
<script type="text/javascript">
<!--
function playSound(sfile) {
// load a sound and play it
window.location.href=sfile;
}
//-->
</script>
</head>
<body onLoad="playSound('Type.wav')" onUnLoad="playSound('Glass.wav')">
<h2>
Sounds on JS Events
</h2>
<hr>
The following are examples of JS event handlers used to play sounds.
<hr>
<a href="#" onClick="playSound('Cashreg.wav')">
Click here for sound
</a>
<p>
<form name="form1">
<input type="button" value="Play" onClick="playSound('Gunshot.wav')">
</form>
</p>
</body>
</html>
|