日期:2014-05-17 浏览次数:20779 次
<style> *{font-size:12px;} div{z-index:1;} #dialog-form {border:1px solid #000;width:400px;background:#fff;max-height:300px; z-index:1000;position:absolute;display:none;top:40%;left:40%;margin-top:-100px;margin-left:-150px;} #dialog-form div#dialog-content{height:150px;overflow-y:auto;} #dialog-form h4{background:#CECECE;color:black;height:35px;margin:0px;} #dialog-form h4 span {float:left;padding:10px;} #dialog-form h4 span#close {float:right;cursor:pointer;} #dialog-form h3{background:#fff;color:black;} #dialog-form p{padding:2px 5px 5px 5px;} #dialog-form input{padding:2px 2px 5px 5px;width:60px;margin:1px;} </style>
function showDialog(){ var showDia=document.getElementById('dialog-form'); showDia.style.display = "block"; mybg = document.createElement("div"); mybg.setAttribute("id","mybg"); mybg.style.background = "#000"; mybg.style.width = "100%"; mybg.style.height = "100%"; mybg.style.position = "absolute"; mybg.style.top = "0"; mybg.style.left = "0"; mybg.style.zIndex = "500"; mybg.style.opacity = "0.3"; mybg.style.filter = "Alpha(opacity=30)"; document.body.appendChild(mybg); } function closeDialog(){ var showDia=document.getElementById('dialog-form'); var bg=document.getElementById('mybg'); showDia.style.display="none"; document.body.removeChild(bg); }
<form action="index.do"> ..... ... <button id="search" onclick="showDialog()">検索...</button> </form>
</div> <div id="dialog-form" title="検索"> <h4><span>検索</span><span id="close" onclick="closeDialog()">CLOSE</span></h4> <form> <div id="dialog-content"> <fieldset> <table width="80%" border="0" cellspacing="1" cellpadding="3" align="center" class="contentTable"> <tr class="defaultBGColor"> <td align="center" class="editLabel"></td> <td align="center" class="editLabel">グループ名</td> </tr> <% for(int i=0; i<result.size(); i++) { %> <tr class="defaultBGColor"> <td align="center"><input type="checkbox" name="sub_group" value="<%=result.get(i)%>" /></td> <td id="groupName" align="center"><%=result.get(i)%></td> </tr> <%} %> </table> </fieldset> </div> <h3 style="text-align:right" ><input type="submit" value="OK"/><input type="button" value="CANCEL" onclick="closeDialog()"/></h3> </form> </div>