jQuery Iframe 父页面监听子页面的鼠标点击事件

墨蓝 2022-05-15 08:34 1237阅读 0赞

一、父页面加入iframe:





二、父页面加入如下脚本:

$(function () {

  1. $("\#ifrmReport").height($(document).height()+200);
  2. var bodyWidth = $(document.body).width();
  3. $("\#ifrmReport").width(bodyWidth - 200);
  4. var iframe = document.getElementById('ifrmReport');
  5. iframe.onload = function () \{
  6. iframe.contentDocument.onclick = function () \{
  7. iframe.contentWindow.parent.hideZKZ();
  8. \};
  9. \}
  10. \});

function hideZKZ() {

  1. //easyUI combotree关闭下拉选择树
  2. $("\#check\_ZKZ").combobox('hidePanel');
  3. //easyUI combotree收缩下拉选择树
  4. $("\#check\_ZKZ").combotree('tree').tree("collapseAll");

}

发表评论

表情:
评论列表 (有 0 条评论,1237人围观)

还没有评论,来说两句吧...

相关阅读