星空网 > 软件开发 > Java

window的对象有哪些(笔记)

window的主对象主要有如下几个:

document 对象;

frames 对象;

history 对象;

location 对象;

navigator 对象;

screen 对象;

全局变量和函数都是window的属性。

window的窗体函数:

 open() 函数:打开(弹出)一个新的窗体;

 close() 函数:关闭窗体;

 opener 属性:通过opener可以实现跨窗体之间的通讯,但是要保证是在同一域名下,而且一个窗体要包含另一个窗体的opener。

window.open(url, name, features, replace);

open函数参数说明:

url -- 要载入窗体的URL

name -- 新建窗体的名称(也可以是HTML target属性的取值,目标);

features -- 代表窗体特性的字符串,字符串中每个特性使用逗号分隔;

replace -- 一个布尔值,说明新载入的页面是否替换当前载入的页面,此参数通常不用指定。

对话框函数:

 alert() 函数;

 confirm() 函数:返回boolean值;

 prompt(str1,str2) 函数:可输入对话框(“此处str1不能编辑”、“str2可以编辑”)。

定时器常用函数:

时间等待与间隔函数:

setTimeout(a,b) 函数,指定时间之后执行的方法。a为要执行的方法,b为时间间隔,单位毫秒。

clearTimeout(i) 函数,清除指定的setTimeout函数执行,例:var i=setTimeout(a,b)。

setInterval(a,b) 函数,每隔时间b循环执行a;

clearInterval(i) 函数,清除定时器,例:var iu=setInterval。

window.location对象 

解析URL对象location

location对象的属性有:href,protocal,host,hostname,port,pathname,search,hash

     document.write(location.href + "<br/>");    // http://localhost:4889/javascriptTest.html    document.write(location.protocol + "<br/>");  // http:    document.write(location.host + "<br/>");    // localhost:4889    document.write(location.hostname + "<br/>");  // localhost    document.write(location.port + "<br/>");    // 4889    document.write(location.pathname + "<br/>");  // /javascriptTest.html    document.write(location.search + "换行<br/>"); //http://localhost:4889/javascriptTest.html?id=1&name=张三 如果路径是这样,则输出 ?id=1&name=%E5%BC%A0%E4%B8%89    document.write(location.hash);         //http: //localhost:4889/javascriptTest.html#kk=你好?id=1&name=张三 如果路径是这样,则输出 #kk=你好?id=1&name=张三

 




原标题:window的对象有哪些(笔记)

关键词:win

win
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

东南亚夏季持续高温“炭烤”!TikTok小店头巾、水瓶、保湿霜等单品狂销上万件:https://www.ikjzd.com/articles/1665649572946059265
跨境周报|Temu新政新“压榨”,亚马逊验证潮持续:https://www.ikjzd.com/articles/1665651840147726337
成功案例|独立站增长71%,安克创新如何转型?:https://www.ikjzd.com/articles/1665652321012707330
Wish邮整合是缩影?跨境物流行业或迎来洗牌!:https://www.ikjzd.com/articles/16657
亚马逊印度站点解析:https://www.ikjzd.com/articles/16658
跨境电商与海外仓设立(上):https://www.ikjzd.com/articles/1665882991454613506
皇帝的皇宫=:https://www.vstour.cn/a/363188.html
海南岛琼海市旅游景点 琼海市的旅游景点:https://www.vstour.cn/a/363189.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流