JS Code in the Yui pop-up window

Source: Internet
Author: User
Yahoo. namespace ("example. container "); // Yahoo. util. event. ondomready (init); var beginer = NULL; function setbeginer (OBJ) {beginer = OBJ;} function getbeginer () {return beginer;} function Init (W, H) {// instantiate the dialogyahoo. example. container. dialog1 = new Yahoo. widget. simpledialog ("dialog1", {width: W, height: H, modal: True, fixedcenter: True, visible: false, draggable: True, constraintoviewport: Tru E}); Yahoo. widget. simpledialog. prototype. cancel = function () {This. cancelevent. fire (); this. hide (); document. getelementbyid ("scont1 "). src = "" ;}; var dialog‑resize = new Yahoo. util. resize ("dialog1", {handles: ["Br"], autoratio: false, minwidth: W, minheight: H, status: false}); dialog1_resize.on ("startresize ", function (ARGs) {If (this. cfg. getproperty ("constraw.viewport") {var d = Yahoo. util. dom; Var clientregion = D. getclientregion (); var elregion = D. getregion (this. element); dialog1_resize.set ("maxwidth", clientregion. right-elregion. left-Yahoo. widget. overlay. viewport_offset); dialog1_resize.set ("maxheight", clientregion. bottom-elregion. top-Yahoo. widget. overlay. viewport_offset);} else {dialog?resize.set ("maxwidth", null); dialog=resize.set ("maxheight", null) ;}, Yahoo. exampl E. container. dialog1, true); dialog‑resize.on ("resize", function (ARGs) {var panelheight = args. height; this. cfg. setproperty ("height", panelheight + "PX") ;}, Yahoo. example. container. dialog1, true); // render the dialogyahoo. example. container. dialog1.render ();} // closefunction saveandclose () {Yahoo. example. container. dialog1.hide (); document. getelementbyid ("scont1 "). src = ""; document. getelementbyid ("s Cont1 "). width = "0" document. getelementbyid ("scont1 "). height = "0"; document. getelementbyid ("autoscrolliframe "). src = ""; document. getelementbyid ("autoscrolliframe "). width = "0"; document. getelementbyid ("autoscrolliframe "). height = "0";} function saveandclose2 () {Yahoo. example. container. dialog2.hide (); document. getelementbyid ("scont2 "). src = ""; // document. getelementbyid ("scont2 "). width = "0"; // document. g Etelementbyid ("scont2 "). height = "0";}/*** display the modal layer. When the width and height are input, automatically adjust the IFRAME width and height * @ Param {string} layer title * @ Param {string} in the IFRAME layer to display the iframe id in the path * @ Param {string} layer, the default value is scont1 * @ Param {int} layer width. The default value is 860 * @ Param {int} layer height. The default value is 520 */function _ show (header, reqpath, frameid, W, H, isscroll) {var showframeid; var defaultwidth = 860; var defaultheight = 520; var defaframeframeid = 'scont1'; // alert ('W: '+ W + '; '+ 'H:' + H); If (Frame Id = ''| typeof (frameid) =" undefined ") {showframeid = defaframeframeid;} else {showframeid = frameid;} // alert (, W, h W + H); If (W = ''| typeof (w) =" undefined ") {W = defaultwidth ;} if (H = ''| typeof (H) =" undefined ") {H = defaultheight;} // alert ('W: '+ W + '; '+ 'H:' + H); var dframe; If (isscroll) {dframe = document. getelementbyid ('autoscrolliframework'); document. getelementbyid (showframeid ). width = 0; Document. getelementbyid (showframeid ). height = 0;} else {dframe = document. getelementbyid (showframeid); document. getelementbyid ('autoscrolliframework '). width = 0; document. getelementbyid ('autoscrolliframework '). height = 0;} dframe. width = W; dframe. height = H; Init (W + 20 + 'px ', H + 50 + 'px'); // Init (); document. getelementbyid (showframeid ). srcdframe. src = reqpath; Yahoo. example. container. dialog1.setheader (hea Der); Yahoo. example. container. dialog1.show ();}/*** make a map like Java. * You can use this map like this: * var mymap = new map (); * mymap. put ("key", "value"); * var key = mymap. get ("key"); */Function Map () {This. elements = new array (); this. size = function () {return this. elements. length;} This. isempty = function () {return (this. elements. length <1);} This. clear = function () {This. elements = new array () ;} This. Put = function (_ key, _ value) {If (! This. containskey (_ key) This. elements. push ({key: _ key, value: _ value});} This. remove = function (_ key) {var bln = false; try {for (I = 0; I <this. elements. length; I ++) {If (this. elements [I]. key = _ key) {This. elements. splice (I, 1); Return true ;}} catch (e) {bln = false;} return bln ;} this. get = function (_ key) {try {for (I = 0; I <this. elements. length; I ++) {If (this. elements [I]. key = _ key) {return this. elements [I]. value ;}} catch (e) {return NULL ;}} this. element = function (_ index) {If (_ index <0 | _ index> = This. elements. length) {return NULL;} return this. elements [_ Index];} This. containskey = function (_ key) {var bln = false; try {for (I = 0; I <this. elements. length; I ++) {If (this. elements [I]. key = _ key) {bln = true ;}} catch (e) {bln = false;} return bln ;}this. containsvalue = function (_ value) {var bln = false; try {for (I = 0; I <this. elements. length; I ++) {If (this. elements [I]. value = _ value) {bln = true ;}} catch (e) {bln = false;} return bln ;}this. values = function () {var arr = new array (); for (I = 0; I <this. elements. length; I ++) {arr. push (this. elements [I]. value);} return arr;} This. keys = function () {var arr = new array (); for (I = 0; I <this. elements. length; I ++) {arr. push (this. elements [I]. key) ;}return arr ;}}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.