473,545 Members | 1,288 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Background Sound in HTML / Javascript

Gil
I'm trying to write a page that allows me to change the background
midi that's playing.

I've been going crazy consulting Google Groups, and coming up with
ingenious solutions, some of which kind of work in some situations.
I'm quite prepared to implement a number of solutions simultaneously
and browser-distinguish to select the right one, but it's hard even to
find the criteria that decide what works in which browser.

I'd be grateful for any advice.

Solution 1 - which looks the cleanest. It works with some IEs -
5.00.2614.3500I S in particular

I put all the desired midis in the body of the page as EMBEDs, with
name properties, then when I want to change the tune, I call a
Javascript function,

function newsong(newname )
{
for (var ii=0; ii < document.embeds .length; ii++)
{
if (oldname == document.embeds[ii].name)
{
document.embeds[ii].stop();
break;
}
}

for (var ii=0; ii < document.embeds .length; ii++)
{
if (newname == document.embeds[ii].name)
{
document.embeds[ii].play();
break;
}
}
oldname = newname;
}

Example http://www.amazonsystems.co.uk/bridge/Page1.htm - The Save
button changes the tune in theory.

Solution 2 - Messy but straightforward - this works with Netscape 4.08
and with IE 5.00.2614.3500I S, but not 5.00.2614.3500

Again, I include and name all the EMBEDs (I have to have MASTERSOUND
for Netscape to work.)

function newsong(newname )
{
document.embedn ame1.stop();
document.embedn ame2.stop();
document.embedn ame3.stop();
....etc.
if (newname == embedname1) document.embedn ame1.play();
else if (newname == embedname2) document.embedn ame2.play();
else if (newname == embedname3) document.embedn ame3.play();
else if (newname == embedname4) document.embedn ame4.play();
....etc

Example http://www.amazonsystems.co.uk/bridge/Page2.htm - The Save
button changes the tune in theory.
Solution 3 - Messier still - have a separate tiny html page for each
midi, and call it up when required, without releasing the original
page. It seems easier to build a page that works everywhere if you
don't need to change the background sound.

I haven't implemented that, but it's ghastly.

Gil
Jul 20 '05 #1
3 4600
Gil
gi*@humbug.co.u k (Gil) wrote in message news:<8f******* *************** ****@posting.go ogle.com>...
I'm trying to write a page that allows me to change the background
midi that's playing.

etc....

Oh, and I'm now working on Solution 4 that puts static BGSOUND / EMBED
for each song in a separate, otherwise empty HTML file, with the
intention of putting the tune in a tiny frame <spit>, and the other
stuff in the main frame, changing the contents of the tiny frame,
rather than trying to change the tune in the main frame.... wish me
luck. I've never been reduced to using frames before.

Gil
Jul 20 '05 #2
On 27 Nov 2003 07:41:36 -0800, gi*@humbug.co.u k (Gil) wrote:
gi*@humbug.co. uk (Gil) wrote in message news:<8f******* *************** ****@posting.go ogle.com>...
I'm trying to write a page that allows me to change the background
midi that's playing.

etc....

Oh, and I'm now working on Solution 4 that puts static BGSOUND / EMBED
for each song in a separate, otherwise empty HTML file, with the
intention of putting the tune in a tiny frame <spit>, and the other
stuff in the main frame, changing the contents of the tiny frame,
rather than trying to change the tune in the main frame.... wish me
luck. I've never been reduced to using frames before.

Gil

Surely it should be <spit/> or <spit></spit>!

Paul
Jul 20 '05 #3
Gil
Frames solution now up as
http://www.amazonsystems.co.uk/bridge/Page4.htm

Gil
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5321
by: erik | last post by:
Is it posssible to inherit the previous pages (parent pages) background image? Is there a script out there I could look at? Thanks
4
9594
by: Peter | last post by:
I've embedded a midi file as background sound in my "index.html" which links to other pages on the site and I want the the same background sound to play on all pages "without interruption (and restarting)" when going to the other pages. Can anyone give me some insight as to how this can be done? Appreciate any help offered. TIA Peter
3
4741
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
2
6230
by: lrandolph | last post by:
Is there a way to allow a user to record a sound file from javascript or html? We need to be able to record and convert to binary to send via XML. If possible, we'd like this to be a server side process as our customer does not want to have to install software on the client workstations. Thanks, Lynne
2
1990
by: fuliopen | last post by:
I put background sound with tag <bgsound src=''> in a page, and like to give the visitor an option to unable it. Can this be accomplished? If yes, what's the tag or command? Thanks.
4
4081
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If so, how? See my HTML below (or go to my test page at http://fmbbowen.com:39353/misc/Misc.html). I also tried treating ..color as a number and...
11
1837
by: Steve Kirkendall | last post by:
I need a work-around for an IE limitation, regarding fetching HTTP documents in the background. It takes a bit of explaining; please be patient... I'm working on an project that will run on an intranet. I need to have pages be reloaded automatically when the data they reflect is changed at the server. For Netscape/Mozilla/Firefox, I do...
26
3861
by: Jake Barnes | last post by:
I did a search on the newsgroup comp.lang.javascript. I was searching for "how to play a sound with Javascript". I'm somewhat suprised that the majority of entries are from the 1990s, and there are almost no posts from the last 3 years: ...
1
2333
by: OBAFGKM_RNS | last post by:
In my html, I have an embedded sound wav. I access that sound from my javascript using Play() and Stop(). However, once stopped, the sound will aways resume from where it left off, (making Stop behave more like a Pause). I want it to start from the beginning. The only way I've been able to start the sound from the beginning every time, is...
0
7456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7649
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5960
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5320
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4940
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1010
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.