jquery in Lhgdialog plugin (i)

Source: Internet
Author: User

A: Preface

Recently in the use of jquery control, actually wrote before but suddenly encountered the need to pass from the pop-up window to the parent window, suddenly feel that this way of passing the value is actually the basis of JavaScript, but I have not yet to really do it, so let's record it.

  II: Content  

Let's talk about Lhgdialog.js and Lhgcore.lhgdialog.min.js, Lhgdialog.min.js.

Lhgdialog.min.js: is a compressed version of Lhgdialog.js, the so-called compression version is the JavaScript code to go to space, line, to annotate, simplify the non-open variable name and so on to achieve the function of not modifying the original code to reduce the size of the file. Therefore, the compression version is used during the debugging phase, and the compact version is used in the full version deployment.

lhgcore.lhgdialog.min.js: When you import JS, you need to import the JS first, Because lhgdialog.js inside the JS code, if you have jquery.js in the framework can not import lhgcore.lhgdialog.min.js, I first talk about my own use of the effect, I import the Web page lhgcore.lhgdialog.min.js and Lhgdialog.js, the effect is that the popup form cannot change the style is the form color, but I import jquery.js and lhgdialog.js can change the style, this may be the compatibility issue

URL parameter for window lhgdialog.min.js file
Parameters in the form of: <script type= "Text/javascript" src= "Lhgdialog.min.js?self=true&skin=chrome" ></script>
Self: Specifies the page for the popup window
Type: String
Default: ' False '
Description: This parameter is only used in frame pages, if this parameter is not written or if the value is false, the window pops up in the top-most page of the frame, if the value is true, not across the frame, but on the current polygon page.
Skin: Multiple skins shared CSS file name
Type: String
Default: ' Default '
Description: The value is default if this parameter is not written. If you want to use a different skin window on the same page, the value here is the file name of the CSS where the multiple skins coexist
URL parameters do not need to be set to write, do not write when the default value is used.

<!DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "Http://www.w3.org/TR/html4/loose.dtd "><HTML>    <Head>        <Metahttp-equiv= "Content-type"content= "text/html;charset=gb2312" >            <Scripttype= "Text/javascript"src= "Jquery-1.9.1.js"></Script>                <Scripttype= "Text/javascript"src= "Lhgdialog.js?self=true&skin=igreen"></Script>            <Scripttype= "Text/javascript">$ (document). Ready (function(){            $(". Printbutton"). Bind ("Click",function() {$.dialog ({title:'The first time Lhgdialog.js Test!!! '});            });            }); </Script>        </Meta>    </Head>    <Body>        <inputtype= "button"value= "Test"class= "Printbutton">    </Body></HTML>

First the JS code to see

$ ("#chooseGoods"). Click (function(){                varArrs =NewArray (); $("Input[class= ' XH ']"). each (function() {Arrs.push ($ ( This). Val ());                }); $.dialog ({title:"Select Commodity", data:{"Arrs": Arrs},ok:function(){                        varresult = ""; vararrays =NULL; varCount = 0; $("Input[type= ' checkbox ']:checked", This. content.document). each (function(index) {if($( This). attr ("id")! = ' Checkall ') Count++;                        }); if(count = = 0) {$.dialog.alert (' No records selected, please select ',function() {}, $dialogParent ()); return false; }                        $("Input[type= ' checkbox ']:checked", This. content.document). each (function(index) {//dynamically assigning a value to a page                            if($( This). attr ("id")! = ' Checkall ') {result=  $( This). attr ("returnvalue");//find this returnvalue in the parent windowarrays = Result.split ("# #"); //$ (this). Parent () refers to td,$ (this). Parent () the parent () refers to TR, which is the third column in this row .                        varjqmc=$ ( This). Parent (). Parent (). Find ("Td:eq (3)"). text (); varA = $.grep (Arrs,function(n,i) {returnN==arrays[0];//returns the result of an equal value}); if($.type (a) = = ' undefined ' | | a== ') {ADDSJ (arrays[0],arrays[1],arrays[2],arrays[3],jqmc,arrays[5],arrays[6]);                    }                            }                        }); }, Content:"Url:${base}/goods/goods_checklist.action", Width:"1000px", Height: "500px", Lock:true, Parent: $dialogParent ()});        }); });

The usage of grep can be seen as follows:

http://www.jquery001.com/jquery-grep-function.html;

Introduction of http://www.css88.com/archives/2472

In the parent window, there is a paragraph such as JS used to determine the selected data (for example, when you select a time, found that the selection is less or wrong, the parent window needs to be selected when you click)

jquery Property Description: http://blog.csdn.net/mayanling0113/article/details/7403149

 //  page load initialize  $ (document). Ready (
   
    function  
     () { 
    var  API =
     frameelement.api;//This thing gets the object of the interface  
    if  (Api.data.arrs!=
    null  
     for  (var  i=0;i<api.data.arrs.length;i++ "input[type= ' che Ckbox '][value= ' "+api.data.arrs[i]+" '] "). attr (" Checked ", true  ); }            }        });
   
<align= "center"><type= "checkbox" value = "${goods." ID} "  ID=" ${goods.zfid} "  return_value=" ${goods. Id}##${goods. Bh}##${goods.mc}##${goods.lx}##${goods.sl}##${goods.jg}##${goods.dz} "  name=" Checkboxname "  /></td>

Small Knowledge Points:

About the difference between parent and parents

Parent: It can be said to be the parents of the current object. For example <td><input type= "text" name= "input" ></TD>, here: $ (: Text). The parent element of parent () is <td></td>

Parents: It can be said that your family as long as the ancestors of your generation are, you can see that this is to see the element in that siege.

Here is a link can be directly to learn, will be very detailed. I tried it myself again and felt good:

http://blog.csdn.net/cui_angel/article/details/7903704

Three: summary

Recently, I've been trying to experiment with these front-end frameworks. Feel that hands-on is not the same, there are a lot of problems to do before you know. Efforts! Originally said to leave, the result manager again let me stay, I do not know is to stay is to go, in fact very contradictory. Because I still think I can learn a lot of things now. Knowledge in a little bit of growth, now just feel that they are not enough experience ah. So I might as well decide ... Pending status Ah.

The beginning of the action is to start with this pop-up box and decide to use spring MVC to build the framework and use MyBatis to connect to the database. A step-by-step test. Ready to begin. Go!

        

jquery in Lhgdialog plugin (i)

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.