Play Sound with javascript DHTML

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Sep 2008
Posts: 12
Reputation: arshadshaikh is an unknown quantity at this point 
Solved Threads: 0
arshadshaikh arshadshaikh is offline Offline
Newbie Poster

Play Sound with javascript DHTML

 
0
  #1
Sep 23rd, 2008
How to play sound file like .wav file with javascript and/or DHTML when some one mouseover to a link. I have done this... but it only works in IE while it does not work in other browsers like firefox and chrome.

Can any body help me regarding this issue.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: Play Sound with javascript DHTML

 
0
  #2
Sep 23rd, 2008
This should work!
If not then try to check you plug-ins...

  1. <html>
  2. <head>
  3. <title><!-- Sample --></title>
  1. <script type="text/javascript">
  2. <!--
  3. function playSound( mysound )
  4. { thisSound = document.getElementById(mysound);
  5. thisSound.Play();
  6. }
  7. //-->
  8. </script>
  1. </head>
  2. <body>
  3. <embed src="someaudiofile.mp3/mid/wav" autostart="false" width="0" height="0" id="sound1" enablejavascript="true" />
  4. <br />
  5. <a href="javascript:void(0);" onmouseover="playSound('sound1');">Play Sound!</a>
  6. </body>
  7. </html>
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 12
Reputation: arshadshaikh is an unknown quantity at this point 
Solved Threads: 0
arshadshaikh arshadshaikh is offline Offline
Newbie Poster

Re: Play Sound with javascript DHTML

 
0
  #3
Sep 24th, 2008
Thank you so much for your kind help. Its working in firefox. But actually problem is this that with this script sound does not come instantly as it comes in other script which i use for IE.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 3
Reputation: p_midtlyng is an unknown quantity at this point 
Solved Threads: 0
p_midtlyng p_midtlyng is offline Offline
Newbie Poster

Re: Play Sound with javascript DHTML

 
0
  #4
Sep 29th, 2008
Hello -
I'm new to dynamic webpages, and I need some help.
This thread is relevant to me, but does not exactly answer my question.

The code below generates a webpage that automatically plays a part of a soundfile, depending on what name and start and end times are delivered to it in the PHP part of the code.

The question I have is that in Opera, Firefox/Mozilla everything works perfectly, and you can click on the .gif and the script will run again and the sound will play again. However this is not the case in IE. The script will run, and play part of the section that it is supposed to play, but not all of it, and if it does not play all of it, clicking on the .gif generates a 'null' is null or not an object error. Line 16 Char 1.

Any help would be much appreciated.

P.
<?php

$filename=$_GET['filename'];
$starttime=$_GET['starttime'];
$endtime=$_GET['endtime'];

print '
<html>

<head>
<meta name=Title content="Digital Maya Website Audio">
<meta name=Keywords content="">
<meta http-equiv=Content-Type content="text/html; charset=macintosh">

<LINK REL=StyleSheet HREF="style.css" TYPE="text/css" MEDIA=screen>

<title>Website Title</title>

<script>
function EvalSound(soundobj) {
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>

</head>

<body bgcolor=white lang=EN-US style="border:0;margin=0;align=center">

<div class=Section1>

<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width=0
height=0>
<param name="src" value="'.$filename.'">
<param name="scale" value="tofit">
<param name="controller" value="true">
<param name="autoplay" value="true">
<param name="loop" value="false">
<param name="starttime" value="'.$starttime.'">
<param name="endtime" value="'.$endtime.'">
<embed src="'.$filename.'" id="s001" scale=tofit width=1 height=1 align=center controller=false autoplay=true
loop=false starttime="'.$starttime.'" endtime="'.$endtime.'" enablejavascript=true
pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime"></EMBED></OBJECT>

<form>
<img src="http://www.webucateus.com/dotnetnuke/Portals/0/Cache/images/soundIcon.gif" height=50 onClick="EvalSound(\'s001\')">
</form>

</div>

</body>
</html>
';
?>
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC