复选框的实现-创新互联
一.roll 12补丁之后 IE9
function relationDateCheck() {
var PL = crmForm.all.new_allowrelationdate;
var PLV = crmForm.all.new_checkallowrelation;
PL.style.display = "none";
PLV.style.display = "none";
// Create a DIV container
var addDiv = document.createElement("div");
addDiv.setAttribute("style", "overflow-y:auto; height:40px;border: 1px #00000 solid;background-color: #ffffff;");
PL.parentNode.appendChild(addDiv);
// Initialise checkbox controls
for (var i = 1; i < PL.options.length; i++) {
var pOption = PL.options[i];
var addInput = document.createElement("input");
addInput.setAttribute("type", "checkbox");
addInput.setAttribute("name", "test");
addInput.setAttribute("onclick", "getRelationDateValue()");
addInput.setAttribute("style", "border:none; width:25px; align:left;");
if (IsRelationDateChecked(pOption.text, PLV)) {
addInput.setAttribute("checked", "checked");
}
var addLabel = document.createElement("labal");
addLabel.innerText = pOption.text;
PL.nextSibling.appendChild(addInput);
PL.nextSibling.appendChild(addLabel);
}
}
// Check if it is selected
function IsRelationDateChecked(pText, PLV) {
if (PLV.value != "") {
var PLVT = PLV.value.split(";");
for (var i = 0; i < PLVT.length; i++) {
if (PLVT[i] == pText)
return true;
}
}
return false;
}
function getRelationDateValue() {
var PL = crmForm.all.new_allowrelationdate;
var pick = crmForm.all.new_checkallowrelation;
var value = "";
var getInput = PL.nextSibling.getElementsByTagName("input");
for (var i = 0; i < getInput.length; i++) {
if (getInput[i].checked) {
value += getInput[i].nextSibling.innerText + ";";
}
}
Xrm.Page.getAttribute("new_checkallowrelation").setValue(value);
}
分享题目:复选框的实现-创新互联
新闻来源:http://ybzwz.com/article/dcjgsc.html