?
Solved

Launching a .wav with a mouseclick

Posted on 1997-05-20
2
Medium Priority
?
320 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 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…
Suggested Courses

764 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