DHTML - JavaScript Random Background Sound Code
This tiny script plays a randomly selected sound for your visitors when they come to your site. You may add as many sound files as you like. Easy copy and paste installation. Cross-browser. Reload in order to hear the random effect!


Install it

Step 1: Open your web page. Paste the following code right above the </body> tag:




Step 2: Put your sound files into the same folder as your web page.
If you like, here are 5 .mid sound files for your usage.
sound1.mid
sound2.mid
sound3.mid
sound4.mid
sound5.mid

Step 3: Open your web page. Go to the top of the script and configure your sound files.


Download 500 free copy-and-paste scripts


Like this code snippet? Why not share it with others by copying this page URL: