View Full Version : playing sound file in Opera, not working help pleez !!!

Mar 8th, 2010, 08:11 AM
I am having a problem with something below and I'm not sure what it is whether its aproblem with HTMl or the sript !, I have inserted some Javascript etc to play a sound file via a 'Play' button and a 'Stop' button !
Everything works fine in IE and Firefox but in Opera the sound file plays onLoad of page and the buttons don,t work !
I posted a link elsewhere and someone said that Opera has a problem playing .wav files so I changed my sound file to an mp3 but once changed the buttons dont work in any browser, I have posted a snippet of my code below, can anyone help its driving me nuts !!!!!!

My site is at http://www.eustonfishingclub.com
if it helps !

<div id="content"><!-- InstanceBeginEditable name="MainContent" -->

<h1>The Gallery</h1>
<p class="intro">This is the Photo Gallery for the Euston Fishing Club</p>
<p>Here you will find all the photo's from recent trips and outings, please click on an album image to view all the photo's from that particular trip !</p>
<p>We hope you enjoy the pics and also welcome any photo's of your own ,if you have any please <a href="../Contact/index.html">Contact the Webmaster</a> via e-mail and send any photo's you would like adding to the Gallery.</p>
<p>Please read the Important caption below if you are having problems viewing the Gallery !</p>

<!-- #BeginLibraryItem "/Library/Fishing Rod End Text Img.lbi" --><img src="../Assets/Images/Global/fishing_rod.gif" alt="Fishing Rod" class="fishingrodSpacer"/><!-- #EndLibraryItem -->
<p class="Important"><strong>IMPORTANT !</strong> - To be able to view the photo's properly in the Gallery you need to have Javascript enabled in your browser, if you click on a link to an album below and see the photo's appear then all is well !<br />
IF NOT you need to <a href="http://www.tranexp.com/win/JavaScript-enabling.htm">Enable Javascript</a> in your browser, instructions on how to do this can be found by clicking on the highlighted link.</p>
<h2>Euston Fishing Club Photo Albums</h2>
<p class="intro">If you would like to play a little music while browsing the gallery please click on the player below !</p>

<!-- Functions Code Block Start-->
/* Here we are creating two functions. The first to start a sound object playing and the second to stop a sound object from playing. */
// This function, when called will play the sound object
function EvalSoundPlay(soundobj) {
var thissound= eval("document."+soundobj);
// This function, when called will stop the sound object
function EvalSoundStop(soundobj) {
var thissound= eval("document."+soundobj);
<!-- Functions Code Block End-->

<!-- Here we are embedding the sound file/s. We give each embedded sound a 'name' that we can refer to in a JavaScript event call.
// Note: You can have multiple sounds embedded but remember that each sound requires a different 'name' and each would require its own set of play/pause buttons. -->

<embed src="smooth_bgd.wav" autostart="false" width=0 height=0 name="sound1" repeat="true" loop="true" enablejavascript="true" />

<div class="musicPlayer"><img src="../Assets/Images/Global/play-button.png" alt="music play button" width="40" height="40" onClick="EvalSoundPlay('sound1')"/><img src="../Assets/Images/Global/stop_button.png" alt="music stop button" width="40" height="40" onClick="EvalSoundStop('sound1')"/></div><!-- End .musicPlayer -->

<div id="gallery"><div class="photoAlbum">
<div class="photo"><img src="../Assets/Images/Gallery/Skipton_25_11_09/Skipton_251109_Thumb.jpg" alt="Fisherman Fishing from Boat" width="131" height="98" /></div><!-- End .photo -->