Background music | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Background music

Is it possible to code music that will play in the background in HTML, so that when a viewer opens my website the music will start playing automatically in the background. Thank-you in advance.

1st Jul 2020, 4:35 PM
Владомир
Владомир - avatar
7 Answers
+ 3
https://code.sololearn.com/WcaJTO58vAWm/?ref=app I created this code and it's working with music. You can get a reference from here and start coding. When a user opens a website means when body load (onload event in HTML) just play the music.
1st Jul 2020, 4:40 PM
Maninder $ingh
Maninder $ingh - avatar
+ 1
I am not making website here, in Sololearn. I'm using an editor called "Sublime Text".
1st Jul 2020, 5:07 PM
Владомир
Владомир - avatar
0
Can you show me the code, please?
1st Jul 2020, 5:06 PM
Владомир
Владомир - avatar
0
If I understand correctly, the background music is working using nit only HTML , but JS as well. Am I right?
2nd Jul 2020, 11:19 AM
Владомир
Владомир - avatar
0
An also, may I ask another question, please? How can I make a button have more than one color? At the moment, I am making the project of my dream. By September it should be finished.
2nd Jul 2020, 11:20 AM
Владомир
Владомир - avatar
0
I,too
8th Aug 2020, 4:54 AM
Вубо. ру
Вубо. ру - avatar
0
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { MusicGenres genres = new MusicGenres(); int count = 0; while (count<5) { genres[count] = Console.ReadLine(); count++; } for (int i = 0; i < 5; i++) { Console.WriteLine("Following: " + genres[i]); } } } class MusicGenres { private string[] genres = new string[5]; //declare an indexer public string this[int i]{ get{ return genres[i];} set{ genres[i] = value;} } } }
23rd Jul 2023, 10:19 PM
Parthasarathi Panda
Parthasarathi Panda - avatar