473,748 Members | 2,470 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 4624
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
5352
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
9607
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
4766
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
6243
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
1994
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
4098
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 subtracting the current color from 0xFFFFFF but that did not work either. The numerous examples I...
11
1854
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 this by having the page use JavaScript to read a special "/update.html" URL in the background. For...
26
3902
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: http://groups.google.com/group/comp.lang.javascript/search?group=comp.lang.javascript&q=how+to+play+a+sound+with+Javascript&qt_g=Search+this+group Even after sorting by date, there don't appear any...
1
2358
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 to use inner.HTML to reload the embedded wav, thereby reopening the media plugin. There is always a...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9250
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8247
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4878
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.