js知识点

    xiaoxiao2021-04-19  84

    1.递归调用使用arguments.callee,指向正在执行的函数指针 例: var num = 3; function test(num){ if (num <= 1 ){ return 1; } else { return num * arguments.callee(num - 1); } } 2.所有浏览器:outerWidth和outerHeight返回浏览器窗口本身的尺寸   chrome:outerWidth、outerHeight和innerWidth、innerHeight返回的值一样,即视口大小而非浏览器窗口大小 3.标准模式:document.documentElement.clientHeight和document.documentElement.clientWidth   混杂模式:document.body.clientHeight和document.body.clientWidth 获取视口的大小 4.调整浏览器窗口大小resizeTo()和resizeBy() 5.window.open("http://www.wrox.com/","wroxWindow","height = 400,width = 400,top = 10,left = 10,resizable = yes");弹到"http://www.wrox.com/"界面, 窗口大小为"height = 400,width = 400,top = 10,left = 10,resizable = yes" 对应window.open()打开的窗口,可以使用window.close()进行关闭 6.提示框:alert()   确认对话框:confirm()    给用户输入文本的提示框:prompt() if(confirm("是否继续进入游戏")){ alert("进入游戏") }else{ alert("不进入游戏") } prompt("what's your name?","Michael");7.window.print()显示“打印”对话框   windoe.find() 显示“查找”对话框 8. function getQueryString(name) { var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); var r = window.location.search.substr(1).match(reg); if (r != null) { return decodeURIComponent(r[2]); } return null; }9.navigator.userAgent检测用户使用的浏览器 var user = navigator.userAgent; if(user.indexOf('iPhone') > -1 ){ alert("用户使用的是iphone手机"); }else{ alert("用户使用的是andriod手机") }
    转载请注明原文地址: https://ju.6miu.com/read-675925.html

    最新回复(0)