Solved

Launching a .wav with a mouseclick

Posted on 1997-05-20
2
318 Views
Last Modified: 2012-08-14
Okay, this shouldn't be too difficult. I just need another idea how to do it most effectively.  I need to play a short .wav file when someone clicks on a link (this is an image, and I will be using 'onclick= ...'  but I don't want to have it open a new window every time. Should I create a frame with a size of 0,0 and target the .wav there?  Or is there a way to make it play without bringin' up a new window. I was hoping for something like "onclick=PlaySound("soundfile.wav");return true;"
Any suggestions? I'll make this one 100 points, as I am anxious for a response, and I was hoping for a really clean method that would work on netscape and explorer both. :)
0
Comment
Question by:jvoisin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
Trevor013097 earned 100 total points
ID: 1265614
Okay try this:-

<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
function start()
{
document.the-name.play(false);
}
</SCRIPT>


<BODY>

<EMBED SRC="filename.wav" HIDDEN=TRUE AUTOSTART=FALSE NAME="the-name" MASTERSOUND>

<a href="JavaScript:start();">Start Music</A>

</BODY>

</HTML>


This simply changes the play property of the embedded sound when you click on the link.
0
 

Author Comment

by:jvoisin
ID: 1265615
But, if you try this with Internet Exploder, you will get 'Object dosen't support this property or method' I was hoping for a method that works with both Netscape and MSIE..

(BTW I did it with MSIE 3.02 and 4.0 both are a no-go)

....
function start(){document.BING.play(false);}</SCRIPT>
<BODY>
....
<EMBED SRC="bing.wav" HIDDEN=TRUE AUTOSTART=FALSE NAME="BING" MASTERSOUND>
....
<a href="javascript:parent.frames[1].history.go(-1)"
  onmouseover="ImgFunc('button1','button1n');showInfo('Go Back One Page');return true;"
  onmouseout="ImgFunc('button1','button1');clearInfo();return true;"
  onclick="start();return true;"
  target ="MD_Page">
...


Everything works awesome in Netscape though, and I think that's 70% or more...

I'll just make it so that the script won't run with exploder.

Thanks alot..  If you think of another way that explorer won't choke on, let me know.  :)

Awesome speed on the answer BTW, less than an hour, I bet the newsgroups would have taken a week at least.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question