Trying to get a javascript function to play a sound

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

Join Date: Feb 2007
Posts: 72
Reputation: adaykin is an unknown quantity at this point 
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Trying to get a javascript function to play a sound

 
0
  #1
Mar 8th, 2007
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:

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <script language="JavaScript" type="text/javascript">
  2. function playSound()
  3. {
  4. src="misc020.wav";
  5. }
  6. </script>
  7.  
  8. <A HREF="http://www.newhorizondesigns.org" onMouseOver="playSound()">Home</A></td>
My Website <-- check out my site!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Trying to get a javascript function to play a sound

 
0
  #2
Mar 11th, 2007
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...
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 730
Reputation: hbk619 is an unknown quantity at this point 
Solved Threads: 7
hbk619's Avatar
hbk619 hbk619 is offline Offline
Master Poster

Re: Trying to get a javascript function to play a sound

 
0
  #3
Mar 11th, 2007
http://www.javascriptkit.com/script/...oundlink.shtml

don't forget to do a onmouseout=stop or it'll carry on going
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 3
Reputation: nhlarry is an unknown quantity at this point 
Solved Threads: 0
nhlarry nhlarry is offline Offline
Newbie Poster

Re: Trying to get a javascript function to play a sound

 
0
  #4
Mar 11th, 2007
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 3
Reputation: smartguynrj is an unknown quantity at this point 
Solved Threads: 0
smartguynrj's Avatar
smartguynrj smartguynrj is offline Offline
Newbie Poster

Re: Trying to get a javascript function to play a sound

 
0
  #5
Mar 12th, 2007
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 ??????
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 72
Reputation: adaykin is an unknown quantity at this point 
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Re: Trying to get a javascript function to play a sound

 
0
  #6
Mar 13th, 2007
Originally Posted by MattEvans View Post
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
Last edited by adaykin; Mar 13th, 2007 at 3:23 pm.
My Website <-- check out my site!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 730
Reputation: hbk619 is an unknown quantity at this point 
Solved Threads: 7
hbk619's Avatar
hbk619 hbk619 is offline Offline
Master Poster

Re: Trying to get a javascript function to play a sound

 
0
  #7
Mar 13th, 2007
pretty sweet8, even if my IE blocked the WMP active x to start with
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC