DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   Trying to get a javascript function to play a sound (http://www.daniweb.com/forums/thread71948.html)

adaykin Mar 8th, 2007 6:10 pm
Trying to get a javascript function to play a sound
 
Hey, I am trying to get a sound to play when the user moves the mouse over on of my links. I don't know javascript, I just copied this code from a book, so it's probably something simple. Here is my code:

<script language="JavaScript" type="text/javascript">
      function playSound()
      {
      src="misc020.wav";
      }
</script>

<A HREF="http://www.newhorizondesigns.org" onMouseOver="playSound()">Home</A></td>

MattEvans Mar 11th, 2007 1:35 pm
Re: Trying to get a javascript function to play a sound
 
That's weird looking script. I can't see any way that it could work - in that context; 'src' wont relate to anything useful.

This page has some example code (lots of examples); it won't work for me; but I'm not on a computer with many media plugins:

http://www.phon.ucl.ac.uk/home/mark/audio/play.htm

Hope that helps some...

hbk619 Mar 11th, 2007 2:45 pm
Re: Trying to get a javascript function to play a sound
 
http://www.javascriptkit.com/script/...oundlink.shtml

don't forget to do a onmouseout=stop or it'll carry on going

nhlarry Mar 11th, 2007 8:42 pm
Re: Trying to get a javascript function to play a sound
 
I use Sound Manager.
http://www.schillmania.com/projects/soundmanager2/

smartguynrj Mar 12th, 2007 2:00 am
Re: Trying to get a javascript function to play a sound
 
the java script doesnt work ... can v include some other class or script to run music in web page or ... some other thing to do ??????

adaykin Mar 13th, 2007 2:23 pm
Re: Trying to get a javascript function to play a sound
 
Quote:

Originally Posted by MattEvans (Post 328073)
That's weird looking script. I can't see any way that it could work - in that context; 'src' wont relate to anything useful.

This page has some example code (lots of examples); it won't work for me; but I'm not on a computer with many media plugins:

http://www.phon.ucl.ac.uk/home/mark/audio/play.htm

Hope that helps some...



thanks I used #4 on that list, and it works, check it out, the links on the left side of the page are where it is designed to play: http://www.newhorizondesigns.org

hbk619 Mar 13th, 2007 5:38 pm
Re: Trying to get a javascript function to play a sound
 
pretty sweet8, even if my IE blocked the WMP active x to start with ;)


All times are GMT -4. The time now is 5:11 pm.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC