<input type="checkbox" name="d1" value="p1" id="dop_1" onclick="click_dop_1()">
<input type="checkbox" name="d1" value="p1" id="dop_2" onclick="click_dop_1()">
function click_dop_1(){
if (document.getElementById('dop_1').checked){
div1.style.display = 'block';
}else{
div1.style.display = 'none';
}
}
function click_dop_2(){
if (document.getElementById('dop_2').checked){
div2.style.display = 'block';
}else{
div2.style.display = 'none';
}
}
<div id="somediv" style="display:none;">1111</div>
<div id="somediv2" style="display:none;">2222</div>
<input type="checkbox" data-show="somediv">
<input type="checkbox" data-show="somediv2">
(function(){
var checkboxs = document.querySelectorAll('input[data-show]');
for (var i=checkboxs.length; i--;) {
checkboxs[i].addEventListener('change', function() {
document.getElementById(this.dataset.show).style.display = (this.checked ? 'block' : 'none');
});
}
})();
<input type="checkbox" name="d1" value="p1" onclick="click_dop()">
<div id="wrap-d1">text d1</div>
<input type="checkbox" name="d2" value="p1" onclick="click_dop()">
<div id="wrap-d2"> text d2</div>
function click_dop(){
document.getElementById('wrap-' + this.name).style.display = this.checked ? 'block' : 'none' ;
}