JavaScript には、ほとんど要素を取得してその表示プロパティを設定する「n」個の JavaScript 関数があります。
function ShowDivforassignclick() {
document.getElementById("FollowupDiv").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
}
function HideDivforassignclick() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable2").style.display = 'block';
document.getElementById("ImageButtonDiv2").style.display = 'block';
document.getElementById("close1").style.display = 'block';
return false;
}
function HideDivforassignclick1() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable2").style.display = 'block';
document.getElementById("ImageButtonDiv2").style.display = 'block';
document.getElementById("close1").style.display = 'block';
return false;
}
function HideDiv() {
document.getElementById("adddiv").style.display = 'none';
}
function HideImageButtonDivcontactinfollowup() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable4").style.display = 'block';
document.getElementById("ImageButtonDiv1").style.display = 'block';
return false;
}
function HideImageButtonDivcontact() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable1").style.display = 'block';
document.getElementById("ImageButtonDiv1").style.display = 'block';
document.getElementById("close").style.display = 'block';
return false;
}
function HideImageButtonDivclose() {
document.getElementById("adddiv").style.display = 'block';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable1").style.display = 'none';
document.getElementById("ImageButtonDiv1").style.display = 'none';
document.getElementById("ImageButtonDiv2").style.display = 'none';
document.getElementById("close").style.display = 'none';
return false;
}
function HideImageButtonDivclose1() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable2").style.display = 'none';
document.getElementById("datatable").style.display = 'block';
document.getElementById("ImageButtonDiv1").style.display = 'none';
document.getElementById("ImageButtonDiv2").style.display = 'none';
document.getElementById("close1").style.display = 'none';
}
function HideImageButtonDivclose1forfollowup() {
document.getElementById("adddiv").style.display = 'block';
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable2").style.display = 'none';
document.getElementById("datatable").style.display = 'block';
document.getElementById("ImageButtonDiv1").style.display = 'none';
document.getElementById("ImageButtonDiv2").style.display = 'none';
document.getElementById("close1").style.display = 'none';
}
function HideImageButtonDivuser() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable2").style.display = 'block';
document.getElementById("ImageButtonDiv2").style.display = 'block';
document.getElementById("close").style.display = 'block';
document.getElementById("close1").style.display = 'none';
return false;
}
function HideImageButtonDivuser1() {
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable2").style.display = 'block';
document.getElementById("ImageButtonDiv2").style.display = 'block';
document.getElementById("close").style.display = 'none';
document.getElementById("close1").style.display = 'block';
return false;
}
function HideImageButtonDivuserinfollowup() {
document.getElementById("FollowupDiv").style.display = 'none';
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("ImageButtonDiv2").style.display = 'block';
return false;
}
function HideImageButtonDivforAdd() {
document.getElementById("ImageButtonDiv").style.display = 'none';
document.getElementById("datatable").style.display = 'none';
document.getElementById("adddiv").style.display = 'block';
document.getElementById("ctl00_ContentPlaceHolder1_ImgNoRecords").style.display = 'none';
return false;
}
function HideImageButtonDivforEdit() {
document.getElementById('ImageButtonDiv').style.display = 'none';
document.getElementById("datatable").style.display = 'none';
document.getElementById("adddiv").style.display = 'block';
return true;
}
function ShowImageButtonDiv() {
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
document.getElementById("adddiv").style.display = 'none';
return true;
}
function ShowImageButtonDivs() {
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
document.getElementById("adddiv").style.display = 'none';
document.getElementById("close").style.display = 'none';
document.getElementById("close1").style.display = 'block';
return true;
}
function ShowImageButtonDivss() {
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
document.getElementById("adddiv").style.display = 'block';
document.getElementById("close1").style.display = 'block';
return true;
}
function ShowImageButtonDivforfollowup() {
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
document.getElementById("adddiv").style.display = 'block';
return true;
}
function ShowImageButtonDiv1() {
document.getElementById("ImageButtonDiv1").style.display = 'block';
document.getElementById("datatable1").style.display = 'block';
document.getElementById("adddiv").style.display = 'none';
document.getElementById("ImageButtonDiv").style.display = 'none';
return true;
}
function showDisplaydiv() {
document.getElementById("ConfirmationPanel").style.display = 'block';
document.getElementById("datatable").style.display = 'block';
document.getElementById("ImageButtonDiv").style.display = 'block';
document.getElementById("adddiv").style.display = 'none';
return false;
}
jqueryを使ってこれらの関数を1つにする本当に簡単な方法があるに違いないと思います。なにか提案を?