js 根据图片大小弹出大小相应的窗口

   
简单的一个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>
相关文章
相关标签/搜索