ウィンドウfocus()
例
新しいウィンドウを開き、それにフォーカスを設定します。
const myWindow = window.open("", "", "width=200, height=100");
myWindow.focus();
新しいウィンドウを開き、ぼかします。
const myWindow = window.open("", "", "width=200, height=100");
myWindow.blur();
定義と使用法
このfocus()
メソッドは、フォーカスをウィンドウに設定します。
このblur()
メソッドは、ウィンドウからフォーカスを削除します。
構文
window.focus()
パラメーター
なし |
戻り値
なし |
ブラウザのサポート
focus()
すべてのブラウザでサポートされています:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |