• 0

How do i incorporate background music?


Question

I haven't coded in html for years and apparentlly I need to re-learn everything. I just wanted to know the code that needs to be implemented, to get a background .wav playing automatically once the user reaches that desired page.

Anyone have an idea?

Thanks.

Cheers!

Link to comment
Share on other sites

25 answers to this question

Recommended Posts

  • 0

you would want to do something like this

<bgsound src="THE SOURCE" loop="-1">

NB: Where it says the source in capitals, thats you need to change that to where the music file is located. Also where it says loop="-1" that means that it will keep repeating, but if u want it to play only once you need to put loop="1" and for two times you will need to put loop="2" and so on....

Link to comment
Share on other sites

  • 0
:laugh: Please, for everyones sake, don't use background music on your website! Please!
neopwi amen to that, brothuh... :no: :pinch:

EDIT: GAH D4MNIT!!! freakin neopwi... and i can't take it out w/ edit, either!!! :angry:

Link to comment
Share on other sites

  • 0

ok, if u want it so a user can stop the music, you would do something like this

<script>
function stop()
{
music.src="";
}
</script>
<bgsound id="music" src="Adema-Freaking Out.mp3" loop="-1">
<div onClick="stop()" >Click Here to stop</div>

OR

<script>
function stop()
{
music.src="";
}
</script>
<bgsound id="music" src="Adema-Freaking Out.mp3" loop="-1">
<a onClick="stop()" >Click Here to stop</a>

and if u want to do it wiv a button

<script>
function stop()
{
music.src="";
}
</script>
Click Here to stop</div>
<bgsound id="music" src="Adema-Freaking Out.mp3" loop="-1">
<a onClick="stop()" >Click Here to stop</a>

Just remember to change the song location...

EDIT: 100th post :laugh: :ninja:

Link to comment
Share on other sites

  • 0
What system32 said.

Background music on sites is horrible.

Disturbes the music I'm playing that I actually WANT to listen to..

neopwi who knows? he might be doing it for a local intranet :ninja:
Link to comment
Share on other sites

  • 0

<script>
function stop()
{
music.src="";
}
</script>
<bgsound id="music" src="music/infernal affairs ost.mp3" loop="-1">
<a onClick="stop()" >Click Here to stop</a>

i added this in my html. it show up but the music was not played.

it was played when i use dreamweaver to preview. but when i upload it with the music file. it didnt play

Link to comment
Share on other sites

  • 0

<script>
function stop()
{
music.src="";
}
</script>
<bgsound id="music" src="Music/infernal.mp3" loop="0" autostart="true">
  <a onClick="stop()" ><font color="#CC3300" face="Comic Sans MS">Click here to 
  stop music. =)</font></a> <font color="#FFFF99" face="Comic Sans MS"> </font>

this is what i type in. im sure its the right directory and stuff.

Link to comment
Share on other sites

  • 0

Make sure the path and filename to the music file is in exactly the same case as it is on the server. Windows doesn't care about uppercase and lower case, but Linux and UNIX do.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.