Skip to content

Learn JavaScript Online | Free Interactive JavaScript Tutorials

Master JavaScript with free, interactive tutorials for beginners and experienced coders. Practice live coding and visualize how JavaScript works step by step.

  • JavaScript Tutorial
  • JavaScript Examples
  • JQuery Tutorial
  • CSS Tutorial
  • HTML Tutorial
  • About Us

Playing Music in JavaScript

It is possible to add multimedia contents to a website using JavaScript. Among them, video and music are the commonest.

To play background music, you can use the following code:

PlayMusic.src=”mj.mp3″;

Check out the full script here:

http://javascript-tutor.net/Javascript_Samples/music.htm

Author Liew Voon KiongPosted on August 23, 2013May 7, 2015

Post navigation

Previous Previous post: Looping in JavaScript
Next Next post: Dealing with the Date Object in JavaScript

JavaScript Made Easy

JavaScript Made Easy

JavaScript Kindle Books

JavaScript Made Easy

JavaScript Made Easy




Share Buttons

Share on facebook
Facebook
Share on pinterest
Pinterest
Share on twitter
Twitter
Share on linkedin
Linkedin

  • JavaScript Tutorial
  • JavaScript Examples
  • JQuery Tutorial
  • CSS Tutorial
  • HTML Tutorial
  • About Us
[Copyright © 2008 Dr.Liew Voon Kiong . All rights reserved ] [Contact] [Privacy Policy]