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 402,965 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 2,605 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: 2767 | Replies: 6
Reply
Join Date: Feb 2007
Posts: 56
Reputation: adaykin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

Trying to get a javascript function to play a sound

  #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:

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

<A HREF="http://www.newhorizondesigns.org" onMouseOver="playSound()">Home</A></td>
My Website <-- check out my site!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Location: Deptford, London
Posts: 943
Reputation: MattEvans has a spectacular aura about MattEvans has a spectacular aura about 
Rep Power: 5
Solved Threads: 47
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Posting Shark

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

  #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...
If it only works in Internet Explorer; it doesn't work.
Reply With Quote  
Join Date: Oct 2006
Location: essex
Posts: 730
Reputation: hbk619 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 7
hbk619's Avatar
hbk619 hbk619 is offline Offline
Master Poster

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

  #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  
Join Date: Mar 2007
Location: Alabama
Posts: 3
Reputation: nhlarry is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
nhlarry nhlarry is offline Offline
Newbie Poster

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

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

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

  #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  
Join Date: Feb 2007
Posts: 56
Reputation: adaykin is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
adaykin adaykin is offline Offline
Junior Poster in Training

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

  #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 2:23 pm.
My Website <-- check out my site!
Reply With Quote  
Join Date: Oct 2006
Location: essex
Posts: 730
Reputation: hbk619 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 7
hbk619's Avatar
hbk619 hbk619 is offline Offline
Master Poster

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

  #7  
Mar 13th, 2007
pretty sweet8, even if my IE blocked the WMP active x to start with
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

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

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