[Javascrip]t windows.open 整理

  • 6550
  • 0
  • JS
  • 2022-05-20

關於windows.open 一些方法 之後會慢慢補上

//開新tab窗的寫法===========================

var strURL = "alonsoStock.php?";

strURL+=".....可以放一些你要的get參數"  或者你是存session or cookie都好,在執行下一行就可以開新tab窗了

window.open(strURL, '_blank' );   =<這一行可以開 新的broswer tab

 

[ASP.NET]利用 JS Popup window 回傳值

https://www.dotblogs.com.tw/mepowerlmay/2019/11/12/162528

 

windows op打開 固定在中間

javascript - Center a popup window on screen? - Stack Overflow

function popupWindow(url, windowName, win, w, h) {
    const y = win.top.outerHeight / 2 + win.top.screenY - ( h / 2);
    const x = win.top.outerWidth / 2 + win.top.screenX - ( w / 2);
    return win.open(url, windowName, `toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${w}, height=${h}, top=${y}, left=${x}`);
}

popupWindow('google.com', 'test', window, 200, 100);

 

 

 

以上文章僅用紀錄資料使用.....