/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] IE not running code to stop audio.

I’ve got an audio file that plays when you first hit a webpage. I need that audio to stop if a link is clicked. I’ve got that working in FireFox by replacing the file that’s playing with a file that doesn’t have any sound, but IE doesn’t seem to recognize the code. Can anyone translate it into an IE compatible version?

<script language=”JavaScript”>
function HideSound(){

<input type=button value=”Stop Sound” onclick=”HideSound()”>

<embed id=”BSound” height=”96″ src=”SoundFile.mp3″ hidden=”true” autostart=”true” width=”128″></embed>

to post a comment

3 Comments(s)

Copy linkTweet thisAlerts:
@ZeroKilledMar 02.2009 — honestly, replacing the file with a file that have no sound is useless because it require network activity which may slow loading content. i would prefer to remove the element when user hit the button.
</i>var bsound = document.getElementById('BSound');

if you planing to provide a button to play the sound after removing, you might want to append the removed element. however, i'm not sure if that will actually play the sound. has not tried the code but almost sure should work.
Copy linkTweet thisAlerts:
@justinbarneskinMar 03.2009 — document.getElementById('BSound').stop()
Copy linkTweet thisAlerts:
@nbcrockettauthorMar 03.2009 — I tried the stop command, but it didn't work. ZeroKilled's code works fine for what I'm needing. Thanks guys!


Help @nbcrockett spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 11.30,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ

legal: ({
terms: of use,
privacy: policy
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
recent_tips: (
tipper: @bahaedd,
tipped: article
amount: 1000 SATS,

tipper: @Balmasexy,
tipped: article
amount: 1000 SATS,

tipper: @mbsaad,
tipped: article
amount: 1000 SATS,