一口一口

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>弹出图片的js效果 </title>
<style>

</style>
<script>
function zC(){
 var cWidth,cHeight;
 cWidth = screen.width;
 cHeight = screen.height;
 var cObj = document.createElement("div");
 cObj.setAttribute("id","cdiv");
 cObj.style.position = "absolute";
 cObj.style.top = 0;
 cObj.style.left = 0;
 cObj.style.backgroundColor = "#CCCCCC";
 cObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";
 cObj.style.width = cWidth +"px";
 cObj.style.height = cHeight + "px";
 cObj.style.zIndex = "1000";
 document.body.appendChild(cObj);
 var iObj = document.createElement("img");
 iObj.setAttribute("id","cimg");
 iObj.style.position = "absolute";
 iObj.style.top = "50%";
 iObj.style.left = "50%"; 
 iObj.style.width = "500px";
 iObj.style.height ="400px";
 iObj.style.marginLeft = "-220px" ;
 iObj.style.marginTop = -155+"px";
 iObj.style.textAlign = "center";
 iObj.src = "images/3.jpg";
 iObj.style.zIndex = "1001";
 iObj.style.cursor = "hand";
 iObj.onclick = function(){
  document.body.removeChild(iObj);
  document.body.removeChild(cObj);
 }
 document.body.appendChild(iObj);
}
</script>
</head>

<body>
<img src="images/1.gif" border="0" onclick="zC()" style="cursor:hand" />

</body>
</html>

posted on 2008-03-14 10:18  一口一口  阅读(2332)  评论(0编辑  收藏  举报