asahun
asahun

Reputation: 195

Creating popup from an iframe using jquery

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
   });
 }

Upvotes: 0

Views: 3864

Answers (1)

asahun
asahun

Reputation: 195

I used window.parent to call the function which creates the second popup and its working.

Upvotes: 1

Related Questions