2016年3月10日 星期四

[javascript]windown.open 新視窗 置中

  1. $(function () {
  2. $("#Query").click(function () {
  3. //視窗的垂直位置 600是height
  4. var Top = (window.screen.availHeight - 30 - 600) / 2;
  5.  
  6. //視窗的水平位置 450 是 width
  7. var Left = (window.screen.availWidth - 10 - 450) / 2;
  8. window.open('@Url.Action("QueryMainPageID")', "搜尋官網ID",
  9. config = "innerheight=600,innerwidth=800,top=" + Top + ",left=" + Left);
  10. });

沒有留言:

張貼留言