PDA

View Full Version : Wav script



nycguurl
11-12-2007, 04:24 AM
Hi, I'm back. :rolleyes:

I have this cute little wav script that I'm using to try to make a certain sound on mouseOver, and another one onClick. I am positive I did something wrong in the script because only the on mouseOver one works.

Will someone help me? :confused:
Here is my example:
http://moneytreeaffiliates.com/Practice.htm

Bob90
11-12-2007, 06:35 PM
I believe that when the link is clicked, the onclick event handler is called after the link is, hence the link is performed first.

I think there are two ways around this:

1. Use a differnt type of object like <img onclick....etc>

2. Use onmousedown() like <a href="http://www.google.com" onmousedown="playSound()"...... etc>

:)

nycguurl
11-12-2007, 09:29 PM
Thanks so much for the reply. It's still not working. There must be more wrong with my code. Any more help from you or anyone would be greatly appreciated... ;)

nycguurl
11-13-2007, 12:06 AM
Here's my code. It's really clean-nothing else on the page I mean.
I know the answer must be so obvious to one of you coding geniuses. ;)




<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>

<script>
function EvalSound(soundobj) {
var thissound= eval("document."+soundobj);
thissound.Play();
}
function EvalSound1(soundobj) {
var thissound= eval1("document."+soundobj);
thissound.Play();
}
</script>

</head>



<body>

<embed src="Wav_1.wav" autostart=false width=0 height=0 name="sound1"
enablejavascript="true">

<embed src="Wav_2.wav" autostart=false width=0 height=0 name="sound2"
enablejavascript="true">

<p align="center"><a href="http://google.com"><img border="0" src="Adobe_icon.gif" onMouseOver="EvalSound('sound1')" onClick="EvalSound1('sound2')" width="32" height="32"></a></p>

</body>

</html>

nycguurl
11-15-2007, 05:39 PM
Ok, on my own, I finally got the two sounds to happen like I want. I took Bob90's advice, then did a little something else to manipulate the code, but who knows what. I have no idea.

But now I am hoping someone can assist me with the last part of the problem. Is there any way to have 2 onMouseover functions together? What I want is a rollover image, and the sound wav. I read in lots of places that this is possible if you put a semicolon in between, but it's not working. Can somebody help me? :o

Here's my page again:
http://moneytreeaffiliates.com/Practice.htm