The HTML structure is as follows:
Copy Code code as follows:
<title> Add click event for Body </title>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8" >
<script type= "Text/javascript" src= "Jquery-1.5.2.js" ></script>
<script>
function Show_body_click () {
Alert (' You are click the Body ');
}
JQuery (document). Ready (function () {
JQuery ("ifr_id"). Contents (). Find ("Body"). attr ("onclick", "Show_body_click ()");
Alert (JQuery ("#ifr_id"). Contents (). Find (' body '). attr ("onclick", ' xxxx () ');
var IFR = jQuery ("ifr_id")
});
JQuery (document, ' #ifr_id '). Ready (function () {
JQuery ("#ifr_id"). Contents (). Find ("Body"). attr ("onclick", "Parent.show_body_click ()");
JQuery ("#ifr_id"). Contents (). Find ("the Body"). Live ("Click", "Parent.show_body_click ()");//ff no effect
JQuery ("#ifr_id"). Contents (). Find ("Body"). Click (Parent.show_body_click ()); FF has no effect
});
</script>
<body id= "body_id" >
<span>
<iframe id= "ifr_id" src= "eval.html" height= "100px" width= "800px" ></iframe>
</span>
</body>