INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

controling sound (IE)

How to controle playing of sounds. by N3XuS
Posted: 3 Oct 03

1st off:
You could controle sound using next methods:

<script>
function start() {
      document.all.sound.play();
      //document.all.sound.stop();
}
</script>
<body onload="document.all.sound.play()">
<embed src="sound.wav" autoplay="true" name="sound"></embed>
<A href="#" onmouseover="start()">START</A>
</body>
this doesn't seem to work on all PCs though, probably has something to do with sounds being played by different plugins. Both my PCs that had realplayer installed wouldn't accept the play() and stop() methods.

A workaround this problem is each time you wanna start a sound and stop it , re-initiate the sound source and times it has to loop.
1: put ur sound as backgroundsound.
<bgsound src="#" id=sound loop=1 autostart="true">
2: to start the sound do
    document.all.sound.loop=5000
    document.all.sound.src= 'typewriter.wav'
   to stop the sound do
    document.all.sound.loop=0
    document.all.sound.src= 'typewriter.wav'

it may not be the cleanest solution, but it seemed to work on all my PCs running IE.

Back to Javascript FAQ Index
Back to Javascript Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close