User Tools

Site Tools


js:comprehension

Today, someone gives me a lession:

What's the javascript?

var popupDialog = $('<iframe src="" height="450" width="800" style="border:0;">');
//I get jQuery object, in this object, it doesn't include other plugin's method.
 
 
//After I introduce jquery.simplemodal-1.4.js, 
//It doesn't work. because  close() method is in simplemodal's object or jQuery's object.
popupDialog.close();
function() {
  var popupDialog;
 
  function closePopup(){
   window.parent.page.closeSelfSearchPopup();
  }
 
 
 return {
  closeSearchPopup : function() {
   closePopup();
  },
 
  closeSelfSearchPopup: function(){
   popupDialog.close();
  }
 }
}
 
 
//out page can not acess private variable: popupDialog directly. 
//so we need to use method to acess it: closeSelfSearchPopup();
 
//Since we create a new <iframe> then in the <iframe> we want to 
//call closeSearchPopup, so we have to go to parent page:
//window.parent.page.closeSelfSearchPopup();
js/comprehension.txt · Last modified: 2018/07/24 08:13 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: 沪ICP备12046235号-2
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki