473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Problem playing an embedded sound

I am not an expert in javascript, so forgive me if all this sounds
dumb.
On my webpage, I have slot machine. I want to hear a click sound when
the wheels stop spinning. Heres how i can SORT OF do it:

in my javascript:
var sound = document.getElementById("wl1_click");sound.Play();

and in my html:
<embed id="wl1_click" src="clickb.wav" width="0" height="0"
autostart="false" />

and here are the problems:
1. If i use hidden="true", the sound won't play in either Firefox
or IE. Without that line, it plays.
2. Even setting the width and height to "0", still shows an
annoying tiny image in Internet Explorer, and creates a big extra
space. Hidden="true" would solve that problem, but hidden="true"
prevents the sound from playing for me.
3. Also in IE, an annoying tag pops up saying "press SPACEBAR or
ENTER to activate and use this control."

I'm probably doing something wrong, so if anyone could help, it would
be much appreciated. Thanks.
Jul 2 '08 #1
1 1813
On Jul 2, 12:09 am, OBAFGKM_...@yahoo.com wrote:
I am not an expert in javascript, so forgive me if all this sounds
dumb.
On my webpage, I have slot machine. I want to hear a click sound when
the wheels stop spinning. Heres how i can SORT OF do it:

in my javascript:
var sound = document.getElementById("wl1_click");sound.Play();

and in my html:
<embedid="wl1_click" src="clickb.wav" width="0" height="0"
autostart="false" />

and here are the problems:
1. If i usehidden="true", the sound won't play in either Firefox
or IE. Without that line, it plays.
2. Even setting the width and height to "0", still shows an
annoying tiny image in Internet Explorer, and creates a big extra
space.Hidden="true" would solve that problem, buthidden="true"
prevents the sound from playing for me.
3. Also in IE, an annoying tag pops up saying "press SPACEBAR or
ENTER to activate and use this control."

I'm probably doing something wrong, so if anyone could help, it would
be much appreciated. Thanks.
I kind of rigged up a solution to these problems by doing this:
<div style="position: absolute; z-index:
-1;left:-10000;top:-10000;"><embed id="wl1_click" src="clickb.wav"
width="0" height="0" autostart="false" ></div>

Now the 1 pixel media player with the accompanying space and "press
SPACEBAR..." messagebox are out of view.
Jul 2 '08 #2

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

Similar topics

4
by: Brian Basquille | last post by:
Hello all, What is the syntax for simply playing a WAV file in your program? Am learning VB and have two VB books but don't wanna root through them to find the code. Any help would be much...
1
by: Kiteman \(Canada\) | last post by:
Instead of a beep sound playing as an alarm or reminder I would like to be able to play a more interesting sound. On the web, I found and tried a sound routine that uses the SOUND.DRV but it does...
1
by: Peter Schmitz | last post by:
Hi, I'm just trying to play a *.wav file, making use of the unmanaged function "sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid, that the sound file itself has to be...
2
by: laredotornado | last post by:
Hello, I had been given this code to play a single sound file embedded in a page. Sadly, the code doesn't actually "play" any sound file. Could you help supply some JS code that will play a sound...
7
by: Lee Moody | last post by:
I just want quick and easy way to play a .wav file out the standard sound device. It could even be as simple as activating a sound assigned to an existing windows sound event. Any suggestions?...
1
by: Terry Olsen | last post by:
Using the following routine to play embedded wav files: Private Sub PlaySound(ByVal Sound As Int32) Select Case Sound Case 1 : My.Computer.Audio.Play(My.Resources.Sounds.GoOnline,...
4
by: fAnSKyer/C# newbie | last post by:
I am using winmm.dll and I found that I can't just suspend it and resume it? What should I do? Any better idea? Should I use thread? and thread.suspend will work? Thanks
4
by: Benzerari | last post by:
Hi All; Please, if any one knows the visual basic code, to be added to a Stop button in order to stop playing some sound of (*.Wav) type. I have achieved to find the code for start playing sound...
3
by: Jack | last post by:
Hi, I'm writing a simple wav player (like winamp) and using the SoundPlayer class in c# 2005. Using winform buttons, I can begin playing the sound and stop half-way through the sound using:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.