multiple onmouse______events?

  rolmes 23:00 14 Nov 06

I am trying to invoke 2 javascript events within 1 html tag. The desired result is acheived when I view the web page in Opera, but not when viewed in Explorer, Netscape nor Firefox. I want to action the first event when the mouse is clicked, and the second event when the mouse click is released (therefore I am using the 'onmousedown' and 'onmouseup' events). The first event is to activate a sound file, and the second event is to hyperlink to another page. When I invoke the code in opera, on clicking the mouse the sound file is played, and on releasing the mouse the next page is hyperlinked to - when it is invoked in the other browsers, the sound file is played but the next page is not hyperlinked to. The (full) code that I have used is below. I would be very grateful if someone could offer a suggestion as to why a) it works perfectly in opera and not in any other browser b) where I am going wrong, and most importantly c) what I need to do to ensure it works in all 4 of the above browsers. Thanks in advance.

a onmousedown="self.location='SWEEP.wav'; return false;", onmouseup="href='pageone.html'">Page one /a>

  rolmes 08:51 15 Nov 06

Sorry, the above is a typo - my </a> tag is typed correctly.

  MikeyMooMoo 13:48 17 Nov 06

Surely the mouseup action should be; window.location.href='pageone.html';

Although you may find the browser redirects before finishing the sound, so what i would do is run a function onmouseup that firstly initiates the sound file, then use setTimeout("window.location.href='pageone.html'",n);

where n = no of miliseconds!

hope this helps

  rolmes 15:28 17 Nov 06

thanks for the post, but your suggestion works in the same way as the code I am already using i.e. the sound file is hyperlinked to and played, and the second file (where I want the user to be directed to) is not actioned.

This thread is now locked and can not be replied to.

Huawei P10 review

1995-2015: How technology has changed the world in 20 years

An overview: What leading creative agencies are doing to improve diversity

New iPad, iPhone SE & Red iPhone 7 on sale now