The jqueryalert pop-up check box. For more information about the code, see. // JQuery Alert Dialogs Plugin Version 1.0
// Plug-in: http://abeautifulsite.net/notebook/87
The original method is as follows:
The Code is as follows:
// Usage:
// JAlert (message, [title, callback])
// JConfirm (message, [title, callback])
// JPrompt (message, [value, title, callback])
1. Add a public method of multicheckbox:
// Public methods
Multicheckbox: function (message, value, title, callback ){
If (title = null) title = 'multicheckbox ';
$. Alerts. _ show (title, message, value, 'multicheckbox', function (result ){
If (callback) callback (result );
});
},
2. In the private method _ show: Added multicheckbox control in function (title, msg, value, type, callback:
// Private methods
------------------------ Key part ------------------------------
Case 'multicheckbox ':
$ ("# Popup_message"). append (value). after ('
Select All OK cancel
');
Var $ spanHover = $ ("# dialog span ");
$ SpanHover. hover (
Function () {$ (this). addClass ("spanmousehover ");},
Function () {$ (this). removeClass ("spanmousehover ");}
);
$ ("# Checkall"). click (function (){
If ($ ("# checkall" ).html () = "select all "){
$ ("# Dialog input"). each (function () {$ (this). attr ("checked", true );});
$ ("# Checkall" ).html ("cancel all ");
}
Else {
$ ("# Dialog input"). each (function () {$ (this). attr ("checked", false );});
$ ("# Checkall" ).html ("select all ");
}
});
$ ("# Delcheckall"). click (function (){
$ ("# Dialog input"). each (function () {$ (this). attr ("checked", false );});
});
$ ("# Popup_ OK"). click (function (){
Var getAll = "";
Var test = $ ('# dialog input '). each (function () {if (this. checked) {getAll + = $ (this ). val () + ',';}});
Var valback = getAll. substring (0, getAll. length-1); // remove the last ','
$. Alerts. _ hide ();
$ ("# Ctl00_ContentPlaceHolder_main_TextBox_recever_sel"). blur ();
If (callback) callback (valback); // after you click OK, upload all the selected content back to the input box.
});
$ ("# Popup_cancel"). click (function (){
$. Alerts. _ hide ();
$ ("# Ctl00_ContentPlaceHolder_main_TextBox_recever_sel"). blur ();
If (callback) callback (null );
});
//----------------------------------------------------------------------
Add the following name to // Shortuct functions:
JMulticheckbox = function (message, value, title, callback ){
$. Alerts. multicheckbox (message, value, title, callback );
};
3. Call the following script in the onfocus attribute of the input box (or asp: TextBox) of the previous Code:
JMulticheckbox ('', '<% = allcheckinfo. ToString () %>', select the receiving department, function (r ){
// Define the input html element. In the pop-up box, the main title and callback result (that is, the selected content)
If (r! = Null)
$ ('# Ctl00_ContentPlaceHolder_main_TextBox_recever_sel'). val (r );
});
In this example, "allcheckinfo. ToString ()" can be used to retrieve the results from the corresponding business logic in the background, for example:
StringBuilder allinfo = new StringBuilder ("");
Allinfo. Append ("
");
...
While (OracleDataReader. Read ())
{
String bumeninfo = oradr [0]. ToString ();
Allinfo. Append (""+ Bumeninfo +"
");
}
...
Allinfo. Append ("
");
That is
...
Return to JS. The final result is as follows: