Jump to content
xisto Community
Sign in to follow this  
suicide1405241470

background sound

Recommended Posts

As part of my college work I have produced a web page, that as to include dertain elements: meta tag info, internal + external link, images, text One audio clip, and one video clip, use of frames and a no frames option, one input form, and to demonstrates the use of a template. The problem is, I thought I had everything covered, and recieved some negative feedback, which I don't mind, but the problem is I know the music is annoying (no one more than me does) but until my tutor grades my work there it stays. So how can I make it so that it turns off (like a button or something) here is the code <bgsound src="blackhole.mid" loop="3"> Here is the website http://forums.xisto.com/no_longer_exists/ Please take a look, this is my first attempt and I really don't want to submit my work if it aint right Thanks

Share this post


Link to post
Share on other sites

ok this is my code for you. i will explain as good as i can

This code is to embed the sound onto the page. the loop value makes the sound loop until it is stopped. the autostart value is there so it starts when the page loads and the hidden value is there to keep the sound from showing up on the webpage visually. the MASTERSOUND is there to say that this is the top level sound, if you hade many sounds on the webpage.:

<embed name="BlackHole" src="blackhole.mid"loop="true" hidden="true" autostart="true" mastersound>

To stop the background music you can call the:
document.BlackHole.stop()
method. This method is cross-browser compatible... i think. The "document" refers to the webpage the music is on. the "BlackHole" refers to the embedded sound, which it locates through the NAME tag in the embed tag. and the "STOP()" part stops the sound.

To call this from a text link use this code:
<a href="#" onClick="document.bgSound.stop(); return false;">Stop Music</a>

For a button use this:
<input type="button" value="Stop Music" onclick="document.bgSound.stop(); return false;">

If you need anymore help or if something doesnt work just post.

Share this post


Link to post
Share on other sites

hey thanks but wont it be easy for newebies like me to just use FLash it can put ur music to site with not diffficulty.But thanks for the code will give it a try

Share this post


Link to post
Share on other sites

You could use flash but if you require something like suicide needs then this is a good and simple way to do it, the only way i know of. I don't think it is that hard to figure out what the code does, even for a "newbie".

Share this post


Link to post
Share on other sites

Background sound is one of the most trickiest things of web development. This is because1. A cross-browser, valid XHTML method is hard to implement.2. It is considered to be annoying as users may not like it.However, with valid (X)HTML, you can use <object> I suppose, but it doesn't work as well in Internet Explorer. You can workaround that with a conditional comment. Here is the code:

<object data="soundfile.mid" codetype="audio/mid"></object><!--[if IE]><bgsound loop="3" src="basdanse.mid" /><![endif]-->

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.