Play Sound File In The Web Page, JavaScript Code
This has to be the easiest way to play a sound file on your website, and you get to
use JavaScript. Wait about 10 seconds and you will hear the sound. Also, this script
opens the sound in another window.
Script Demo:
JavaScript Code:
Insert this code into <head> tags
|
Insert this code into <body> tags
|
Instruction:
- Copy and paste this JavaScript into your HTML between the
<head></head>. Change the text
"YOUR SOUND FILE" to the path of the sound/music
file.
- Replace
<body> with <body
onLoad="PlaySound()">