JS and JSF text before check box plus popup box

Source: Internet
Author: User

<!--normal pop-up box--
<div class= "Mid-alert" id= "Strategyokalertid" style= "Display:none;" >
<div class= "Alert-head" >
<span class= "Head-icon" ></span> <span class= "Head-word" > Policy matching </span>
<span class= "Close-alert" id= "Closestrategyokid" ></span>
</div>
<div class= "Alert-body" >
<div class= "Alert-content" >
<div class= "Content-row" >
<div class= "Content-left" >
<input type= "checkbox" Name= "Plan_ebi" id= "Clplanebiall" class= "ItemSelect" checked= "Checked" value= " 511503000000000100 ">
</input> location:</div>
<div class= "Content-right" >
<div class= "Content-right" id= "Ebiplatformid" checked= "checked" ></div>
</div>
</div>
<div class= "Content-row" >
<div class= "Content-left" ><input type= "checkbox" Name= "PLAN_EBM" id= "Clplanebmall" class= "ItemSelect" Checked= "Checked" value= "511503000000000100" >
</input> Attractions:</div>
<div class= "Content-right" >
<div class= "Content-right" id= "Ebmplatformid" checked= "checked" ></div>
</div>
</div>
</div>
</div>
</div>

Click on the node, pop-up box
$ (' #imgStrategyId '). On (' click ', function () {
/* Ajax takes data from the background into the popup box, get method */
var infoid=$ (' #processInfoId '). Val ();
$ ('. Mid-alert '). CSS (' Display ', ' none ');
if ($ (' #imgStrategyId '). Is ('. Warn-mid ')) {
$ (' #checkboxEBIId '). empty ();
$ (' #checkboxEBMId '). empty ();
$ (' #submitStrategyId '). attr (' disabled ', false);
$.ajax ({
Type: ' Get ',
ContentType: ' Application/json ',
URL: $CONFIG [' ContextPath ']+ '/api/duty/getstrategymsg/' +infoid,
Success:function (data) {
if (data) {
var ebiarray=data. EBI;
var ebmarray=data. EBM;
if (ebiarray.length==0 && ebmarray.length==0) {
$ (' #submitStrategyId '). attr (' disabled ', true);
}else{
var checkboxhtml_ebi= ';
var checkboxhtml_ebm= ';
for (var i = 0; i < ebiarray.length; i++) {
for (var key in Ebiarray[i]) {
checkboxhtml_ebi+= ' <input type= "checkbox" Name= "Alias_ebi" checked= "Checked" class= "ItemSelect" value= "' +key+ '"/ > ' +ebiarray[i][key]+ ';
}
}
for (var i = 0; i < ebmarray.length; i++) {
for (var key in Ebmarray[i]) {
checkboxhtml_ebm+= ' <input type= "checkbox" Name= "ALIAS_EBM" class= "ItemSelect" value= "' +key+ '"/> ' +EBMArray[i] [key]+ ';
}
}
$ (' #checkboxEBIId '). Append (Checkboxhtml_ebi);
$ (' #checkboxEBMId '). Append (CHECKBOXHTML_EBM);
}
$ (' #strategyAlertId '). FadeIn (' slow ');
}
},
Error:function () {
$FN. Alert (' <span style= ' color:red;float:left; padding:30px 245px; " > Get failed!</span> ');
}
});
}else{
Clear Content
$ (' #EBIPlatformId '). empty ();
$ (' #EBMPlatformId '). empty ();
$.ajax ({
Type: ' Get ',
ContentType: ' Application/json ',
URL: $CONFIG [' ContextPath ']+ '/api/duty/getstrategyokmsg/' +infoid,
Success:function (data) {
var alias_ebi= ';
var alias_ebm= ';

Traverse the entire contents of the Sub-selection box, checked= "checked" as the default Select all
if (data) {
for (var i = 0; i < data. Ebi.length; i++) {
alias_ebi+= ' <input type= "checkbox" Name= "Alias_ebi1" class= "ItemSelect" checked= "checked" value= "' +i+ '"/> ' + Data. Ebi[i].alias + ";
}
for (var i = 0; i < data. Ebm.length; i++) {
alias_ebm+= ' <input type= "checkbox" Name= "Alias_ebi2" class= "ItemSelect" checked= "checked" value= "' +i+ '"/> ' + Data. Ebm[i].alias + ";
}


$ (' #EBIPlatformId '). HTML (Alias_ebi);
$ (' #EBMPlatformId '). HTML (ALIAS_EBM);
$ (' #strategyOkAlertId '). FadeIn (' slow ');

Add Judgment, control click on the previous main selection box, the sub-selection box will change the selected state control Location box
$ (' #clPlanEbiAll '). Click (function () {
var = $ (this);
var checked = this.checked;
if (checked) {
$ (' input[name=alias_ebi1] '). Prop (' checked ', ' checked ');
}else{
$ (' input[name=alias_ebi1] '). Removeattr (' checked ');
}

});

Control Attractions Box
$ (' #clPlanEbmAll '). Click (function () {
var = $ (this);
var checked = this.checked;
if (checked) {
$ (' input[name=alias_ebi2] '). Prop (' checked ', ' checked ');
}else{
$ (' input[name=alias_ebi2] '). Removeattr (' checked ');
}

});
}
},
Error:function () {
$FN. Alert (' <span style= ' color:red;float:left; padding:30px 245px; " > Get failed!</span> ');
}
});
}

});
In the top right corner, click X to close the popup box
$ (' #closeStrategyId '). On (' click ', function () {
$ (' #strategyAlertId '). FadeOut (' slow ');
})

$ (' #closeStrategyOkId '). On (' click ', function () {
$ (' #strategyOkAlertId '). FadeOut (' slow ');
})
Click the Submit button to submit the data to the background, close the popup box
$ (' #submitStrategyId '). On (' click ', function () {
/* Ajax passes PopOver data to the background, get*/
var infoid=$ (' #processInfoId '). Val ();
var platidstr= ';
var processnode= ' 4 ';
Place
$ (' input[name= ' Alias_ebi "]:checked '). each (function () {
platidstr+=$ (This). Val () + ",";
});
Attractions???
$ (' input[name= ' alias_ebm "]:checked '). each (function () {
platidstr+=$ (This). Val () + ",";
});
$.ajax ({
Type: ' Get ',
ContentType: ' Application/json ',
URL: $CONFIG [' ContextPath ']+ '/api/duty/sendinstruction/' +infoid+ '/' +platidstr+ '/' +processnode,
Success:function (data) {
if (data = = ' 0 ') {
$FN. Alert (' <span style= ' color:red;float:left; padding:30px 245px; " > issued a successful!</span> ');
Showprocess (infoid);
}else if (data = = ' 1 ') {
$FN. Alert (' <span style= ' color:red;float:left; padding:30px 245px; " > Issued Failure!</span> ');
}
$ (' #strategyAlertId '). FadeOut (' slow ');
},
Error:function () {
$ (' #strategyAlertId '). FadeOut (' slow ');
$FN. Alert (' <span style= ' color:red;float:left; padding:30px 245px; " > Processing Failure!</span> ');
}
});
});

JS and JSF text check box and pop-up box

Related Article

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.