Jquery artdialog dialog box plug-in Introduction

Source: Internet
Author: User

Artdialog is a plug-in of jquery's ultra-lightweight pop-up dialog box. Let's introduce how to use artdialog.

Recently, I started to learn about the jQueryEasyUi framework. Now I just learned the basics. I have the following knowledge about its pop-up box:
Import on the page

The Code is as follows: Copy code
<Script src = "js/artDialog4.0.2/artDialog. source. js? Skin = gray "> </script>
<Script src = "js/artDialog4.0.2/artDialog. iframeTools. js"> </script>

The two JavaScript codes can be used to construct the desired Dialog window. The test example is as follows:

Write a button and click to implement the following functions:

The Code is as follows: Copy code

Function openPage (){
Var setting = {href: #, title: 'test', width: 650, height: 380, scrolling: no };
Setting. href = 'path to open the interface ';
// Data can be used to transmit data to the current page.
Art. dialog. data ('key', value );

// Open the window
Art. Dialog. open (setting. href, setting );

}


After the above functions are implemented, you can open the window you want.
In the following interface:

The Code is as follows: Copy code

Var value = art. dialog. data ('key ');

Get the value you want to pass

To refresh the father page:

The Code is as follows: Copy code

Var win = art. dialog. open. origin;
Win. location. reload ();

1. Use traditional parameters

The Code is as follows: Copy code

Art. dialog (content, OK, cancel)

Art. dialog ('simple and pleasant interface, powerful expressiveness, elegant internal implementation ', function () {alert ('yes') ;}); run»

2. Use literal parameters

The Code is as follows: Copy code

Art. dialog (options)

Var dialog = art. dialog ({
Title: 'Welcome ',
Content: 'Welcome to the artDialog dialog box component! ',
Icon: 'sudoed ',
Follow: document. getElementById ('btn2 '),
OK: function (){
This. title ('Warning '). content (' Please note that artDialog will be disabled in two seconds! '). Lock (). time (2 );
Return false;
}
});


The following is a js form that pops up through artdialog and is submitted through ajaxform (The form can be verified using the jquery validate verification control)

The Code is as follows: Copy code

$ (Document). ready (function (){
Var options = {
Target: '# output2 ',
Success: showResponse // post-submit callback
};
$ ('# MyForm'). ajaxForm (options );
Var alt = null;
$ ("# AddHname"). click (function (){
Alt = art. dialog ({
Title: 'add nickname ',
Content: document. getElementById ('G _ cn '),
Width: 750,
Button :[
{
Name: 'save ',
Focus: true,
Callback: function (){
$ ('# MyForm'). submit ();
Return false;
}
},
{
Name: 'close ',
Callback: function (){
}
}
]
});
});

Function showResponse (data ){
If (alt! = Null ){
Alt. close ();
}
If (data = 'success '){
ArtDialog. alert ('saved successfully ');
} Else {
Art. dialog. close ();
ArtDialog. alert ('failed to save ');
}
}
});

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.