JS文件:
<script language="javascript" type="text/javascript">
function zC(url){
var picurl="../"+url;
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 = picurl;
iObj.style.zIndex = "1001";
iObj.style.cursor = "hand";
iObj.onclick = function(){
document.body.removeChild(iObj);
document.body.removeChild(cObj);
}
document.body.appendChild(iObj);
}
</script>
服务器控件:
<img src='<%#Eval("picUrl") %>' οnclick='zC("<%#Eval("picUrl") %>")' style="cursor:hand; width:20PX; height:20px;" />