Wbox/colorbox/pop-up window page transfers values to the parent form

Source: Internet
Author: User
Tags dname

I. jquery wbox-lightweight pop-up window jQuery plug-in, which is only 3.65Kb after compression and developed based on jQuery1.4.2.

The pop-up box shows the effect and adds a lot of interesting functions, such as the callback function, display the hidden layer, Ajax page, and iframe embedding.

Page (for more information: http://www.js8.in/wbox)

$ ("# Selectuser"). wBox ({
IframeWH: {width: 800

},
RequestType: "iframe", // This example is used in iframe
Title: "select a driver ",
Target: "url"
});

2. Upload a value from the pop-up window page to the parent form and register the double-click event on the tab.

<A href = "javascript: void (0)" id = "Driver. UserId" ondblclick = "selectDriverName ('$!

{Driver. UserId} ',' $! {Driver. username} ') ">$! {Driver. username} </a>

<Script type = "text/javascript">
Function selectDriverName (uid, dname ){

// Pass userid and driver name to the parent form
Parent. jQuery ("# UserId"). val (uid );
Parent. jQuery ("# DriverName"). val (dname );

Parent. $ ("# wBox"). contents (). find ('. wBox_close'). click ();

}
</Script>

Note: Before wbox is disabled, you can pass the parameter to the parent page through parent. $ ("# pname "). val ($ ("# name "). val (), if yes

The new one includes the primary key. You need to create it in the background and then call the method in the view of the parent page. After passing the parameter

Close wbox.

 

Controler + View Code

1
2 controler:
3 HQLHelper. Create (coll );
4 string a = "parent. parent. getFid ('"+ coll. c_ID.ToString () + "','" + coll. c_NAME + "'); parent. $ (\ "# wBox \"). contents (). find ('. wBox_close '). click ();";
5 JSHelper. Out ();
6
7 view:
8 <script type = "text/javascript">
9
10 // after adding a folder, return its id and bind the name to the drop-down list.
11 function GetFid (id, name)
12 {
13
14 $ ("# selectColl "). append ($ ("<option value =" + id + "selected = 'selected'>" + name + "</option> "));
15
16}
17

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.