Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sound plays locally, stops after a couple of seconds on site.

Status
Not open for further replies.

mgason

Technical User
Joined
Feb 6, 2003
Messages
158
Location
AU
Hi,
Not sure if the problem is Javascript, but seems plausible. I am a complete noob to Javascript.
I have a page with some mp3 audio. Rough working version can be found here. All the buttons call the same sound at the moment, it's not a bug.
The sound works fine when I test locally in browsers but when it is on the site the sound stops after a couple of seconds.
If I click continuously the sound keeps going!
Any ideas?

I am using script
Code:
<script>
function EvalSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Play();
}
function EndSound(soundobj) {
  var thissound=document.getElementById(soundobj);
  thissound.Stop();
}
</script>
embedding the sound
Code:
<embed src="uploads/2ndGraders.mp3" autostart=false width=0 height=0 id="sound1"
enablejavascript="true"></embed>
then calling it like this
Code:
<INPUT TYPE="image" SRC="uploads/microphone-icon-64.jpg"
ALT="PLay Sound" NAME="Submit now" onClick="EvalSound('sound1')">

<INPUT TYPE="image" SRC="uploads/microphone-icon-64x.jpg"
ALT="Stop Sound" NAME="Submit now"  onClick="EndSound('sound1')">
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top