Kill The Music

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

astrodaddy

Thread Starter
Joined
Dec 23, 2003
Messages
244
Hello,

Im looking for an easy way for visitors to disable the background music on my site. Ive found a couple of JavaScripts that was supposed to do this but either it didnt work or I did something wrong.

Ive found this code, but cant seem to get it to work.


<!-- ONE STEP TO INSTALL BACKGROUND MUSIC SWITCH:

1. Copy the coding into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the BODY of your HTML document -->

<BODY>

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: SPD team ([email protected]) -->
<!-- Web Site: http://www.superprodesign.com -->
<script>
<!--Original script by SPD. Visit us for more scripts like this one at www.superprodesign.com Forbidden by copyright law to remove this comments under any situation. Enjoy! -->
<!--Write the background's sound URL between the "" like in the example below-->
musi="1mid.mp3"
<!--Don't edit from here on-->
function mus1()
{
if (t.options.selectedIndex==0){
mus.innerHTML="<embed src="+musi+" loop=-1>"
}
if (t.options.selectedIndex==1){
mus.innerHTML=""
}
}
document.write("<span id='mus' style='position:absolute;top:-90000'><embed src="+musi+" width=0 height=0 loop=-1></span>")
</script>
<select name="t" onchange=mus1()>
<option>Enable background music
<option>Disable background music
</select>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.29 KB -->

Ive tried repeatedly to make this work, but to no avail.
My site is http://www.sghsociety.com if you want to take a look.

Thanks for the help!
 
Joined
Nov 3, 2005
Messages
45
the way i did it on my site was just to embed the music without the autostart option. because if it turns on straight away thats bound to p*** people off. my site is www.itechnet.co.uk the code i used was:
<div>
<embed
src="sounds/brethart.mp3"
autostart=false
width=146
height=16
>
</div>
which automaticaly asigns a quicktime style control
If you look at my site(a bret hart fansite) the conrols are just under the main menu to the left. it also progressively downloads the music.

Also please leave feedback to improvement you think i could make to the site.
 
Joined
Apr 14, 2001
Messages
2,382
Your page coding is a little sloppy, in future, you should try to post all your javascripts immediately after the top <body> or just before the closing </head> tag (depending on the script).
NOTE: This javascript wont work on all browsers, so you wont get the results your after.

For the code to work in this case, place the following immediately below your opening <body> tag, paying attention to the red part!

Code:
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: SPD team ([email protected]) -->
<!-- Web Site: http://www.superprodesign.com -->
<script language="JavaScript">
<!--Original script by SPD. Visit us for more scripts like this one at www.superprodesign.com Forbidden by copyright law to remove this comments under any situation. Enjoy! -->
<!--Write the background's sound URL between the "" like in the example below-->
[COLOR="Red"]musi="1mid.mp3"[/COLOR]
<!--Don't edit from here on-->
function mus1()
{
if (t.options.selectedIndex==0){
mus.innerHTML="<embed src="+musi+" loop=-1>"
}
if (t.options.selectedIndex==1){
mus.innerHTML=""
}
}
document.write("<span id='mus' style='position:absolute;top:-90000'><embed src="+musi+" width=0 height=0 loop=-1></span>")
</script>
NOTE! you need to change the musi="1mid.mp3" to musi="music/Nothing_Else_Matters.mid" and make sure you dont include the <BODY> tag that is in your original code, otherwise you will have two, and get errors.

Next, place this in the area of the page you want the disable or enable selection:
Code:
<select name="t" onchange=mus1()>
<option>Enable background music
<option>Disable background music
</select>
 

dvk01

Derek
Retired Moderator Retired Malware Specialist
Joined
Dec 14, 2002
Messages
56,452
easiest way is NOT to have background music then you don't need to turn it off

Background music is the invention of the devil and the reason why so many people surf with speakers turned off
 

JohnWill

Retired Moderator
Joined
Oct 19, 2002
Messages
106,521
I agree, I detest sites that assault my ears with their idea of entertainment when I enter. I usually just immediately exit the site. :rolleyes:
 
Joined
Nov 3, 2005
Messages
45
what do you guys think of a site thas has music but doesnt play when you enter. it only plays if you want to listen. does that piss you off, or does it not bother u?
 

dvk01

Derek
Retired Moderator Retired Malware Specialist
Joined
Dec 14, 2002
Messages
56,452
If it has a control that says something like click here for music or something similar then that is perfectly fine and gives the visitor the choice of whether to listen or not

you have to remember the reason for the website is to attract the greatest number of visitors and pissing even one off can really do you harm especially if that visitor might be a reviewer or something
 
Joined
Apr 17, 2005
Messages
9
Would have to agree with the - background music on a website is evil and the devils spawn - group on this one. That's not too harsh is it? ;-)

Now, if you "do" music and you have an area on your site for me to preview your rockin' tunes ... excellent. Nevery play junk for me when I arrive ... nuff said.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top