1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| window.open('https://example.com', '_blank');
window.open("/page1", "_blank", "width=800,height=600");
window.close();
window.alert('这是一个警告对话框');
const result = window.confirm('你确定要继续吗?'); if (result) { } else { }
const userInput = window.prompt('请输入你的名字:'); if (userInput !== null) { } else { }
window.setTimeout(() => { console.log('3秒后执行'); }, 3000);
const intervalId = window.setInterval(() => { console.log('每秒执行一次'); }, 1000);
window.clearInterval(intervalId);
window.location.href = 'https://example.com'; console.log(window.location.pathname); console.log(window.location.search); console.log(window.location.hash);
window.localStorage.setItem('key', 'value'); const value = window.localStorage.getItem('key'); window.localStorage.removeItem('key'); window.localStorage.clear();
window.sessionStorage.setItem('key', 'value'); const value = window.sessionStorage.getItem('key'); window.sessionStorage.removeItem('key'); window.sessionStorage.clear();
window.scrollTo(0, 0);
const resizeHandler = () => { console.log('窗口大小改变'); }; window.addEventListener('resize', resizeHandler); window.removeEventListener('resize', resizeHandler);
window.onload = () => { console.log('页面已加载'); }; window.onunload = () => { console.log('页面卸载前'); };
const { remote } = require('electron'); const currentWindow = remote.getCurrentWindow(); currentWindow.maximize(); currentWindow.minimize(); currentWindow.close();
|