JS點擊事件觸發彈出窗口樣式控制

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>


 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章