Results 1 to 5 of 5

Thread: Wav script

  1. #1
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Unhappy Wav script

    Hi, I'm back.

    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?
    Here is my example:
    http://moneytreeaffiliates.com/Practice.htm

  2. #2
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default I believe

    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>


  3. #3
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    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...

  4. #4
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    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.


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

  5. #5
    Join Date
    May 2007
    Posts
    99
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default

    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?

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •