Firefox equiv of event.cancelBubble?

Results 1 to 2 of 2

Thread: Firefox equiv of event.cancelBubble?

  1. #1
    Join Date
    Dec 1969

    Default Firefox equiv of event.cancelBubble?

    I&#039;ve got code like:<BR><BR>[code language="VB.NET"]&#060;td onClick="EventA()"&#062;<BR> &#060;a href="...." onClick="EventB()"&#062;..&#060;/a&#062;<BR>&#060;/td&#062;[/code]<BR><BR>and i am using cancelBubble() to prevent EventA from being run if the hyperlink is clicked, but i am having trouble getting it to work in FireFox with the "stopPropigation()" method<BR><BR>any ideas how the following code is wrong?<BR><BR>[code language="VB.NET"]function NewWindow(mypage,myname,w,h,scroll) {<BR> ... code to open window ...<BR> if (!e) var e = window.event;<BR> e.cancelBubble = true;<BR> if (e.stopPropagation) e.stopPropagation();<BR> return false;<BR>}[/code]<BR><BR>works in IE, but not FF<BR><BR>thanks in advance<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Firefox equiv of event.cancelBubble?

    Yeah... Need to see all your code. You test for a var called "e", but I don&#039;t see where it&#039;s actually defined. Check this (btw, neat JavaScript highlighting ;-)):<BR><BR>[code language="VB.NET"]<BR>oElement.onkeyup = function(evt)<BR> {<BR> if(typeof evt != &#039;undefined&#039;){ event = evt; }<BR> return handleKeypress(this, event);<BR> }<BR>function handleKeypress(oSelect, oEvent)<BR>{<BR> // ...<BR> // Prevent bubbling<BR> oEvent.returnValue = false;<BR> oEvent.cancelBubble = true;<BR> return false;<BR>}<BR>[/code]<BR><BR>That&#039;s what I tend to use... According to the articles I went lookng for, your method should work. I just don&#039;t think you actually have a reference to the event object under FF/Mozilla.<BR><BR>Craig.<BR>

Posting Permissions

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