Forums >
SuperNote >
IE6 - "return false" on hyperlinks no longer works
Author
Message
1) swinbankGroup: Members Posts: 2Joined: 13 Feb 2007Location: United KingdomIP: 217.34.--.--
Posted:
This issue applies to IE6, but not Firefox or Opera.
"return false" in an onclick handler should stop a hyperlink begin followed. But if a supernote is instantiated (you don't even need to use it), this no longer works on IE. Test case follows:
<script type="text/javascript"> var supernote = new SuperNote('supernote', {animOutSpeed: 1.0, hideDelay: 400}); </script> </head> <body> <a href="http://www.twinhelix.com" onclick="alert('You don\'t want to go to Twinhelix.');return false;">Take me to Twinhelix!</a> </body> </html>
Thanks in advance for any help. Phil
2) Angus TurnbullGroup: Moderators Posts: 4042Joined: 7 Dec 2003Location: New ZealandIP: 125.236.--.--
Posted:
SuperNote hooks into the document click capturing process. I'll look into this -- I'm currently tweaking my event management library code so that might help too.
In the meantime, try this:
onclick="cancelEvent(event, true)"
which uses the event management library directly to kill the event, as "return false" can be a little spotty in general.
Thanks - Angus.
3) swinbankGroup: Members Posts: 2Joined: 13 Feb 2007Location: United KingdomIP: 217.34.--.--
Posted:
Wow - thanks for the fast reply.
That workaround works perfectly for me, so it's job done as far as I am concerned.
Thanks again Phil
4) AmyGroup: Guests IP: 67.135.--.--
Posted:
I believe this is close to a "jumping" issue I have (the page jumps to the content onclick). You can see my implementation of it at: http://www.jocobusiness.net/default.aspx?id=512
I tried onclick="cancelEvent(event, true)" on the link, but it stopped the supernote too. Eep! This seems like it is a simple issue. Thank you for your advice!
This script is absolutely wonderful!
In peace,
Amy
5) Angus TurnbullGroup: Moderators Posts: 4042Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--
Posted:
Hey,
Looks like an interesting implementation! Before we go much further though -- have you perhaps perused the script license agreement? I ask people to either link back here or make a donation instead, have you guys considered doing either?
Anyway, the click-scroll thing doesn't appear to happen with the demo script at all with the click notes. I'm not entirely sure what's causing it at first glance on your page! The cancelEvent call mentioned above could be embedded inside the click handler function in the core script if you want, and you don't have any other scripts that need to process the document click event. In short:
1) Open supernote_commented.js 2) Find "SuperNote.prototype.mouseHandler", and towards the end of that, replace:
if (note.click && (srcElm == trigRef)) cancelEvent(evt);
with:
if (click) cancelEvent(evt);
which may improve the symptoms somewhat. Let me know how it works.
- Angus.
6) AmyGroup: Guests IP: 67.135.--.--
Posted:
That worked beautifully! Merci beaucoup! :-) Right now I am testing the script in our various layouts before implementing it on the library's large site. A note about the script and your site is on our accessibility page at: http://www.jocobusiness.net/templates/JCL_InfoPage.aspx?id=748 Is that all right, or does it need to be on every page?
7) Angus TurnbullGroup: Moderators Posts: 4042Joined: 7 Dec 2003Location: New ZealandIP: 203.173.--.--