①打開新窗口
window.open('about:blank','_blank');? ?//打開一個(gè)空白窗口
如果要往這個(gè)空白窗口寫入內(nèi)容,可以通過這種形式
var oNewWin=window.open('about:blank','_blank');
oNewWin.document.write('hello');
②關(guān)閉窗口
window.close();? ? ? ?要注意火狐瀏覽器只能關(guān)閉由window.open()打開的窗口兔簇。
③拿到用戶使用的瀏覽器的版本
alert(window.navigator.userAgent);
④拿到文件的URL地址
alert(window.location);
⑤提示框
alert(window.confirm("您是否要取消发绢?"));
⑥提示語
alert(prompt("請輸入您的姓名","白敬亭")); //第一個(gè)輸入框(提示語)第二個(gè)框(默認(rèn)在輸入框的內(nèi)容)
⑦前進(jìn)、后退
window.history.back();
window.history.forward();
⑧如何做一個(gè)一直在右下角固定的盒子
?window.onscroll=document.onresize=function(){
? ??????var? scrollTop=document.documentElement.clientHeight || document.body.clientHeight? ????????? ?//先獲取到可視區(qū)高度??
? ? ? ? var div1=document.getElementById('div1');
? ? ? ?div1.style.top=document.documentElement.clientHeight-div1.offsetHeight+scrollTop+'px';
}