layui首页右键刷新事件,刷新iframe红色区域

var CURRLINK    //声明变量
window.onload = function(){
       initFram()
   }
function initFram(){
   //右键菜单
   var menu = document.getElementById("menu");
   var dgBcn = document.getElementsByClassName('iframeurl')
       for (var i = 0; i < dgBcn.length ; i++) {
           dgBcn[i].oncontextmenu = function () {
               var e = e || window.event;
               var oX = e.clientX;
               var oY = e.clientY;
               menu.style.display = "block";
               menu.style.left = oX + "px";
               menu.style.top = oY + "px";
               CURRLINK = $(this).data('url');
               return false;
           }
       }
   menu.onmouseleave = function(e){
      var e = e || window.event; //是为了更好的兼容IE浏览器和非ie浏览器。
      menu.style.display = "none";
   }
   menu.onclick = function(e) {
      var e = e || window.event;
      e.cancelBubble = true;
      menu.style.display = "none";
   }
}
/**
 * 右键菜单打开页面
 */
function rclick(){
   window.open(CURRLINK,"channelmode=yes");
}

猜你喜欢

转载自blog.csdn.net/weixin_39717076/article/details/80229765