code_junkie

Need help with jquery/javascript popup window script - getting weird error in internet explorer

Nov 14th, 2011
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. Line: 51
  2. Error: The interface is unknown.
  3.  
  4. (function($)
  5. {
  6. var _popupTracker = {}
  7. var _popupCounter = 0;
  8. $.fn.openPopupWindow = function(options)
  9. {
  10. var defaults = {
  11. height: 600, // sets the height in pixels of the window.
  12. width: 600, // sets the width in pixels of the window.
  13. toolbar: 0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
  14. scrollbars: 0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
  15. status: 0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
  16. resizable: 1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
  17. left: 0, // left position when the window appears.
  18. top: 0, // top position when the window appears.
  19. center: 0, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
  20. createnew: 0, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
  21. location: 0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
  22. menubar: 0 // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
  23. };
  24.  
  25. var options = $.extend(defaults, options);
  26.  
  27. var obj = this;
  28.  
  29. // center the window
  30. if (options.center == 1)
  31. {
  32. options.top = (screen.height - (options.height + 110)) / 2;
  33. options.left = (screen.width - options.width) / 2;
  34. }
  35.  
  36. var parameters = "location=" + options.location +
  37. ",menubar=" + options.menubar +
  38. ",height=" + options.height +
  39. ",width=" + options.width +
  40. ",toolbar=" + options.toolbar +
  41. ",scrollbars=" + options.scrollbars +
  42. ",status=" + options.status +
  43. ",resizable=" + options.resizable +
  44. ",left=" + options.left +
  45. ",screenX=" + options.left +
  46. ",top=" + options.top +
  47. ",screenY=" + options.top;
  48.  
  49. // target url
  50. var target = obj.attr("href");
  51.  
  52. // test if popup window is already open, if it is, just give it fokus.
  53. var popup = _popupTracker[target];
  54. if (options.createnew == 0 && popup !== undefined && !popup.closed)
  55. {
  56. popup.focus();
  57. }
  58. else
  59. {
  60. var name = "PopupWindow" + _popupCounter;
  61. _popupCounter++;
  62.  
  63. // open window
  64. popup = window.open(target, name, parameters);
  65. _popupTracker[target] = popup;
  66. _popupTracker[target].focus();
  67. }
  68.  
  69. return false;
  70. };
  71. })(jQuery);
  72.  
  73. if (options.createnew == 0 && popup !== undefined && !popup.closed)
Add Comment
Please, Sign In to add comment