User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 423,637 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,157 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 982 | Replies: 0
Reply
Join Date: Oct 2007
Posts: 19
Reputation: tryphy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
tryphy's Avatar
tryphy tryphy is offline Offline
Newbie Poster

Javascript to stop Background Audio in html

  #1  
Jul 8th, 2008
Hi,
I am trying to do with this code. . But i coudnt able to get it work.
It like i embed a background(bg) music in html and also wrote a javascript to stop playing the audio.

The script goes like this..

  1. <script language="javascript">
  2. function stopAudio() {
  3. document.audio.play(false);
  4. // I even tried puting the code stop() as below, yet doesnt work..
  5. // document.audio.stop();
  6. }
  7. </script>
  8. </head>
  9.  
  10. <body>
  11. <embed name="audio" src="aa.mp3" loop="true" width="300" height="90" hidden="true" autostart="true"> </embed>
  12.  
  13. <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="80" height="30">
  14. <param name="movie" value="start.swf" />
  15. <param name="quality" value="high" />
  16. <embed src="start.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="80" height="30"></embed>
  17. </object>
  18. </body>
================================================== ====
In my flash, I created a button and in the button, i have this action script to call the javascript from the html.

  1. on (press) {
  2. getURL("javascript:stopAudio()");
  3. }

When i tried the html, The audio is playing and when i click the button, the audio nver stops..
is there anywhere i have gone wrong?

Thanks for your help.

Regards,
Tryphy.
Last edited by peter_budo : Jul 9th, 2008 at 11:13 am. Reason: Keep It Organized - please use [code] tags
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 10:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC