Recently began to learn the framework of Jqueryeasyui, and now only learned the fur, for its pop-up box like the following understanding:
Import in a 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> |
These two JS, then you can construct the dialog window you want to test the following example:
To write a button, click the function that implements the following:
The code is as follows |
Copy Code |
function Openpage () { var setting={href:#,title: ' Test ', width:650,height:380,scrolling:no}; Setting.href= ' You want to open the path of the interface '; To pass data to a page can be implemented by Art.dialog.data (' key ', value); Open a Window Art. Dialog.open (setting.href,setting); } |
To implement the above function, you can open the window you want.
In the inside of an interface:
The code is as follows |
Copy Code |
var value=art.dialog.data (' key '); |
Get the value you want to pass
If you want to refresh the Father page:
The code is as follows |
Copy Code |
var Win=art.dialog.open.origin; Win.location.reload (); |
First, use the traditional parameters
The code is as follows |
Copy Code |
Art.dialog (content, OK, cancel) |
Art.dialog (' Simple pleasing interface, powerful expressiveness, elegant inner implementation ', function () {alert (' yes ');}); Run
Second, the use of literal reference
code is as follows |
copy code |
Art.dialog ( Options) var dialog = Art.dialog ({ title: ' Welcome ', content: ' Welcome to use the Artdialog dialog box component! ', icon: ' Succeed ', follow:document.getElementById (' btn2 '), ok:function () { this.title (' warning '). Content (' Please note that Artdialog will be closed in two seconds! '). Lock (). Time (2); return false; } }); |
The following is a section of JS that pops a form through the Artdialog and submits it via Ajaxform (the form can validate the form with a jquery validate validation 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 '). S Ubmit (); return false; } }, { Name: ' Close ', Callback:function () { } } ] }; Function Showresponse (data) { if (Alt!=null) { Alt.close () } if (data== ' success ') { Artdialog.alert (' save Success '); } else{ Art.dialog.close (); Artdialog.alert (' Save Failed '); } } }); |