js控制彈出窗口
<a onclick="showDiv(${bagId},'${name}','${isShow}')" style="cursor: hand;">編輯</a>
效果圖:
JS點擊事件觸發代碼(紅色部分爲):
<script type="text/javascript">
function showDiv(id,name,isShow){
var host_div=document.getElementById("host_div");
var isShowArray = document.getElementsByName("isShow");
if(host_div.style.display=="none"){
host_div.style.display="block";
host_div.style.left = (document.body.offsetWidth - 540) / 2;
host_div.style.top = (document.body.offsetHeight - 170) / 2 + document.body.scrollTop;
}
document.getElementById("bagName").value=name;
for(var i=0;i<isShowArray.length;i++){
if(isShowArray[i].value==isShow){
isShowArray[i].checked="true";
}
}
document.getElementById("bagId").value=id;
}
</script>