使用jquery从iframe创建弹出窗口 [英] Creating popup from an iframe using jquery

查看:750
本文介绍了使用jquery从iframe创建弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个弹出窗口,可以加载附带java脚本源的html文件。此弹出窗口由iframe创建。 iframe中的html有链接,预计会创建另一个弹出窗口,但iframe不允许我。无论如何我可以使用父页面创建另一个弹出窗口或者获取iframe。创建第一个弹出窗口的代码如下:



Hello,

I have a popup which loads html file with java script sources attached. this pop up is created by an iframe. the html inside the iframe has link which is expected to create another popup but the iframe is not allowing me. is there anyway i can create another popup using the parent page or get ride of the the iframe. the code that creates the first popup is the following:

function GetPopUp ("../folder/file.htm", "POPUP Title")
 {
  var xpos = mouse_x;
  var ypos = mouse_y;
  var windowID = $(href.split('/')).last()[0].split('.')[0];
  var $dialog = $("#" + windowID)

  var dimensions = GetPopUpDimensions(windowID);

   $('body').after('<iframe id="' + windowID + '" style="padding:0;" src="' + href +    '">  </iframe>');
   $dialog = $("#" + windowID)
   $dialog.dialog(
    {
      autoOpen: false,
      title: title,
      position: 'center',
      sticky: false,
      width: dimensions.DialogWidth,
      height: dimensions.DialogHeight,
      draggable: true,
      resizable: false,
      modal: true,
     close: function () {
        $(this).dialog('destroy');
        $("#" + windowID).remove();
    }
  });
    $dialog.load(function () {
       $dialog.dialog('open');
       $dialog.css("width", "100%"); // reset the width that is set by jquery UI
   });
 }

推荐答案

(href.split('' < span class =code-string> /'))。last()[0] .split(' )[0];
var
(href.split('/')).last()[0].split('.')[0]; var


对话框 =
dialog =


+ windowID)

var dimensions = GetPopUpDimensions(windowID);
("#" + windowID) var dimensions = GetPopUpDimensions(windowID);


这篇关于使用jquery从iframe创建弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆