Topic: overriding onClick events. Pages that link to <a href="https://ozoneasylum.com/backlink?for=28447" title="Pages that link to Topic: overriding onClick events." rel="nofollow" >Topic: overriding onClick events.\

 
Author Thread
protoculture
Nervous Wreck (II) Inmate

From:
Insane since: Oct 2003

IP logged posted posted 09-19-2006 13:11 Edit Quote

ok, so if I have an onclick event for a table row like this..how can I 'override' the <tr onclick:dothis();> and run the 'dothat();' functions in the button and the div?

Because right now if I click anything on that table row the dothis() gets called. Is there a way to disable that without removing that tr onclick?

code:
<tr onclick="dothis();">
  <td>stuff</td>
  <td>more stuff</td>
  <td><input type=button onclick="dothat();" value="I want this function to run, not the one in the tr tag"></td>
  <td>
     <div id="someid" onclick="dothat2();" value="I want this function to run, not the one in the tr tag">
          ---some stuff in div.
     </div>
  </td>
</tr>



(Edited by protoculture on 09-19-2006 13:19)

liorean
Bipolar (III) Inmate

From: Umeå, Sweden
Insane since: Sep 2004

IP logged posted posted 09-19-2006 13:44 Edit Quote

Well, you can try this:

code:
<input type=button onclick="return dothat();" ..>


code:
function dothat(){
    ...
    return false;
}




Or, you can look into the W3C methods Event.stopPropagation and Event.preventDefault and the corresponding properties in iew, Event.cancelBubble and Event.returnValue.

--
var Liorean = {
abode: "http://web-graphics.com/",
profile: "http://codingforums.com/member.php?u=5798"};

protoculture
Nervous Wreck (II) Inmate

From:
Insane since: Oct 2003

IP logged posted posted 09-19-2006 14:39 Edit Quote

any idea how I would use the "W3C methods Event.stopPropagation and Event.preventDefault and the corresponding properties in iew, Event.cancelBubble and Event.returnValue" in the above context?

have any web links?

_Mauro
Maniac (V) Inmate

From:
Insane since: Jul 2005

IP logged posted posted 09-19-2006 14:53 Edit Quote

One idea worth 12'000 links or so:
google <-- event.stoppropagation

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

IP logged posted posted 09-19-2006 15:04 Edit Quote

g event.stoppropagation +explorer
even



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu