Autor Beitrag
Seraph
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 163

Windows.:siXPack:.
Delphi7 Professional
BeitragVerfasst: Mi 14.11.07 17:04 
Hi Leutz!

Wie immer Poste ich nur, wenn ich mal schnell was wissen will! :-D

Ich hatte das Problem, dass ich eine Tabelle (HTML) habe, die ein onClick-Event in jeder Zeile hat! Jedoch gibt es in jeder Zeile eine Zelle, die selbst ein onClickEvent auslöst!

d.h. Beide Events werden hintereinander ausgeführt! Es soll aber nur eins ausgeführt werden!
Bei Letzterem das onClick-Event vom <td> (der Zelle)!

Da man bei Google sofort 12664 Lösungen findet, die alle auf cancelBubble und stopPropagation hindeuten, hat sich dieses Problem schnell erledigt!

Hier mein Code:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
<script type="text/javascript">
 function dominateEvent(e)
 {
  if(e.stopPropagation)
   e.stopPropagation();
  else e.cancelBubble = true;
 }
</script>

<table>
 <tr onClick="Alert(\"test\");">
  <td><a onClick="dominateEvent(event); window.open(\'frameenv.php\', \'pu_user_notice\', \'HEIGHT=200,resizeable=yes,scrollbars=yes,WIDTH=500\'); return false;">Link</a></td>
 </tr>
</table>


Meine Frage jetzt:
Hat sich das Problem wirklich erledigt oder ist das Feature nur unter FF und IE korrekt ausführbar????

Danke im Voraus
und Gruß,
Seraph
Christian V.
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 311

Win Xp Prof
Turbo Delphi 2005
BeitragVerfasst: Mi 14.11.07 22:08 
Ja, das Problem ist jetzt erledigt. Ich hatte bisher nie Probleme mit stopPropagation().

_________________
Hardware runs the world, software controls the hardware, code generates software - Have You already coded today?