簡單的一個js ,但願對你們有幫助
ourl :爲要瀏覽的圖片url
<script language="JavaScript"> function openautosize(ourl) { dimg = new Image(); dimg.src = ourl; w = dimg.width ; h = dimg.height + 28; x = (screen.width - w) / 2; y = (screen.height - h) / 2; window.open("win.aspx","","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,width=" + w + ",Height=" + h + ",top=220,left=280"); // window.open(ourl,"newwindow","location=1,width="+w+",height="+h+",top="+y+",bottom="+y+",left="+x+",right="+x) ; } </script>