js ring a bell on alert box

tyuret used Ask the Experts™
Is there a basic way for alert with sound? Using windows standart noise prompts or ring a bell when I show an alert to user with JS?
Thank you
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Systems Development / Support Specialist
you cannot put a sound to an alert. The alert sound - is what the user specifies on there computer. You can though make a function that plays a sound when the user hits okay on an alert.

Use the sample code and change the mp3 file name which is in your system

<script language="javascript"> 
var alertMessage="This is an alert "
function playSound( url )
  document.getElementById("jukebox").innerHTML="<embed src='"+url+"' hidden=true autostart=true loop=false>";
function userAlert()
<a href="javascript:playSound('Kalimba.mp3');userAlert();">Click Here</a>
<div id="jukebox">

Open in new window


I've tried this.
It starts playing after I close the alert box.
How can we make it first start playing and then show the alert box, then when I close the alert box will stop playing?
Thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial