+ 4
Using js: var music = new Audio() ; music.src = "mlink.typeoffile" ; music.play(); ---------------------------------------------------- new Audio() is setting the type of the variable! .src is setting the link of the audio! .play() is a function to play the audio!
1st Jun 2019, 3:48 PM
CodeFu
CodeFu - avatar
+ 9
To add background music, you have to learn JavaScript
1st Jun 2019, 10:51 AM
🇮🇳Harsh Raj 🇮🇳
🇮🇳Harsh Raj 🇮🇳 - avatar
+ 7
You can not add background music using CSS. You need to use JavaScript to add music. There is a audio class in JavaScript which takes care of music in your website. For example : var background_music = new Audio(); background_music.src = " musiclink.mp3"; background_music.play();
31st May 2019, 12:29 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 4
pause() is the function which you use to stop the play. There is another property called currentTime which is used to get or set the current time of song while it's playing.
31st May 2019, 12:36 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 4
Javascript: new Audio ("yoursong.mp3").play ()
31st May 2019, 5:50 PM
Roj Serbest