944,065 Members | Top Members by Rank

Ad:
Mar 8th, 2007
0

Trying to get a javascript function to play a sound

Expand Post »
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>
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
adaykin is offline Offline
73 posts
since Feb 2007
Mar 11th, 2007
0

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...
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
MattEvans is offline Offline
1,091 posts
since Jul 2006
Mar 11th, 2007
0

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
Reputation Points: 273
Solved Threads: 8
Master Poster
hbk619 is offline Offline
733 posts
since Oct 2006
Mar 11th, 2007
0

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

Reputation Points: 10
Solved Threads: 0
Newbie Poster
nhlarry is offline Offline
3 posts
since Mar 2007
Mar 12th, 2007
0

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 ??????
Reputation Points: 10
Solved Threads: 0
Newbie Poster
smartguynrj is offline Offline
3 posts
since Sep 2006
Mar 13th, 2007
0

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

Click to Expand / Collapse  Quote originally posted by MattEvans ...
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.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
adaykin is offline Offline
73 posts
since Feb 2007
Mar 13th, 2007
0

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
Reputation Points: 273
Solved Threads: 8
Master Poster
hbk619 is offline Offline
733 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Javascript won't work... :(
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Dynamic Iframes





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC