Problem with onClick event of nested div_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:47:58
Original
1027 people have browsed it

I added the onClick event to the outer div in the code below, so that when the mouse clicks on the div, it will jump.
But I added some other effects to the picture, so the jump event cannot be triggered when the mouse clicks on the img in the middle.
How to do this?

<div class="box" onClick="window.open('interest/cloud.php');">	<div class="texts">		<div class="title">云</div>	</div>	<div class="images">		<img src="angel.gif" />	</div>	<div class="texts">		<div class="content">云</div>		<div class="author">云</div>	</div></div>
Copy after login

In short, when the mouse clicks on an area other than the picture, the jump event is triggered, and when the picture is clicked, my other events are executed.


Reply to discussion (solution)

<div class="box" onClick="window.open('interest/cloud.php');">	<div class="texts">		<div class="title">云</div>	</div>	<div class="images" onClick="event.cancelBubble = true">		<img src="angel.gif" />	</div>	<div class="texts">		<div class="content">云</div>		<div class="author">云</div>	</div></div>
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template