Home > Web Front-end > JS Tutorial > jQuery adds the implementation code of click event to the body of iframe_jquery

jQuery adds the implementation code of click event to the body of iframe_jquery

WBOY
Release: 2016-05-16 18:08:22
Original
1441 people have browsed it

html结构如下:

复制代码 代码如下:



为body添加click事件


<script> <br>function show_body_click(){ <br>alert('you are click the body'); <br>} <br>jQuery(document).ready(function(){ <br>//jQuery("ifr_id").contents().find("body").attr("onclick", "show_body_click()"); <br>//alert(jQuery("#ifr_id").contents().find('body').attr("onclick",'xxxx()'));//不能实现 <br>//var ifr = jQuery("ifr_id") <br>}); <br>jQuery(document, '#ifr_id').ready(function(){ <br>jQuery("#ifr_id").contents().find("body").attr("onclick", "parent.show_body_click()"); <br>//jQuery("#ifr_id").contents().find("body").live("click", "parent.show_body_click()");//ff没有效果 <br>//jQuery("#ifr_id").contents().find("body").click(parent.show_body_click()); //ff没有效果 <br>}); <br><br></script>







Related labels:
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