﻿///代码调用方法<input id="Button1" onclick="ShowImg('200811513213839.JPG')" type="button" value="button" />

document.write("<div id='divDisable' style='display:none;width:100%; z-index: 10; position: absolute;left: 0px; top: 0px;filter:alpha(opacity=50);opacity:0.5; background:#000;'></div>");
document.write("<div id='showDiv' style='display:none;z-index:11;position:absolute;text-align:center;width:100%;left: 0px; top: 0px'></div>");
var isIE=document.all ? true: false;
function ShowImg(imgsrc)
{
    document.getElementById("divDisable").style.display='';
    document.getElementById("showDiv").style.display='';
    if(isIE){
        document.getElementById("divDisable").style.height=document.body.clientHeight;
        document.getElementById("showDiv").style.top=document.documentElement.scrollTop+50 ;
    }
    else{
        document.getElementById("divDisable").style.height=document.body.clientHeight+'px';
        document.getElementById("showDiv").style.top=document.documentElement.scrollTop+50+'px' ;
    }
    
    document.getElementById("showDiv").innerHTML="<table align='Center'><tr><td style='padding:10px;background:#FFF;'><img src='"+imgsrc+"' border='0'><div style='text-align:right;padding-right:40px;'><img style='cursor:hand;' onclick='hiddenImg()' src=/Inc/Close.gif></div></td></tr></table>";
}


function PrintImg(imgsrc){ 
	  var code="<div align=center><img src="+imgsrc+"></div><script"+">window.print()</"+"script>";
	  var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
	  newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
	  newwin.document.close();
}

function hiddenImg(){
    document.getElementById("divDisable").style.display='none';
    document.getElementById("showDiv").style.display='none';
}
