Is it possible to block a mouse event on an Hyperlink with a general script event?

N

Neko

Is it possible to block a mouse event on an Hyperlink with a general
script event?

This is quite troublesome for me. I am trying to find a way to block
the windows shortcut SHIFT + MOUSE LEFT BUTTON that open the Hyperlink
in a new window for a Web application. I just want to capture the Shift
click event and prevent it from opening a new page.

Mouse Wheel didn't pose any problems but the other mouse buttons seems
to ignore the cancelBubble proprety.

I'v seen few messages of people saying that they couldn't not make it
work with IE6 and some answers what it did work with IE5. I couldn't
try on IE5 but I tried it on IE7Beta and it Dindn't work.

As I sayd before, only the mouse button seems to not work. Mouse Wheel
work fine.

It may be because the activation of the event click on an Hypertext
have an higher priority than the event in the code and therefore the
annulation of the bubble is useless since the action have been alredy
launch but if if you add a MsgBox("") in the code, there is no new page
opened.

If anyone have a clue about how to solve my problem I would really
appreciate.

P.S.: A way to pass by this problem could be to remove the SHIFT
modificator and simply open a page the normal way but I coudn't find
anything on that either. (But I don't NEED the page to be open on a
shift click, just blocking the event would be really nice)

<script language="vbscript" for="document" event="onmousedown">
<!--
IF window.event.shiftKey THEN
window.event.returnValue = FALSE
window.event.cancelBubble = TRUE
END IF
//-->
</script>
<script language="vbscript" for="document" event="onmouseclick">
<!--
IF window.event.shiftKey THEN
window.event.returnValue = FALSE
window.event.cancelBubble = TRUE
END IF
//-->
</script>
<script language="vbscript" for="document" event="onmouseup">
<!--
IF window.event.shiftKey THEN
window.event.returnValue = FALSE
window.event.cancelBubble = TRUE
END IF
//-->
</script>




<script language="vbscript" for="document" event="onmousewheel">
<!--
IF window.event.shiftKey THEN
window.event.returnValue = FALSE
window.event.cancelBubble = TRUE
END IF
//-->
</script>
 
N

Neko

I forgot to precise, I can't simply add a null event in the <a> since
the links are generated by a DLL and this DLL is used in many
applications.

I know it would have been really easier but I can't do it since too
many other applications depend on it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top