Grundsätzlich verwende ich verschiedene div, um Abschnitte des Textes hervorzuheben. Grundsätzlich würde ich gerne wissen, ob der Benutzer auf diese markierte Auswahl geklickt hat.Gibt es eine Möglichkeit, den onclick eines Elements, das sich hinter einem anderen Element in JavaScript befindet, auszulösen?
Jedoch. Das Hervorhebungs-Div steht hinter dem Text, daher scheint die Onclick-Methode für das Div nicht aufgerufen zu werden. Gibt es da einen Trick um das zu umgehen?
Danke, Grae
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" >
</head>
<body>
<div style="position: relative">
<div style="width:200px;height:200px;background-color: seagreen; position: absolute; left: 40px; top: 40px; z-index: -1" onclick="alert('called?')"></div>
<pre >
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!This is a test!
</pre>
</div>
</body>
</html>
Benötigen Sie wirklich diesen ganzen wiederholten Text für Demozwecke? –
Nein, wahrscheinlich nicht. –
Lesenswert: http://www.quirksmode.org/js/events_order.html –