Slim Slim - 1 year ago 197
Javascript Question

How do I make Javascript beep?

I want my web page to beep whenever a user exceeds the maximum character limit of my


Answer Source

It's not possible to do directly in JavaScript. You'll need to embed a short WAV file in the HTML, and then play that via code.

Here is an example from this page (cleaned up slightly).

function PlaySound(soundObj) {
  var sound = document.getElementById(soundObj);

<embed src="success.wav" autostart="false" width="0" height="0" id="sound1"

You would then call it from JavaScript code as such:


This should do exactly what you want - you'll just need to find/create the beep sound yourself, which should be trivial.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download