zoukankan      html  css  js  c++  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=张三
  • 相关阅读:
    IOS开发中Xcode常用插件安装与管理(转)
    IOS开发中摇一摇是怎么实现的
    IOS中APP开发常用的一些接口
    数据结构——不相交集(并查集)
    数据结构——(最小)堆(完全二叉树)
    JDK1.7 中的HashMap源码分析
    Java中hashCode()方法以及HashMap()中hash()方法
    《Java多线程核心技术》读书摘要
    Java for LeetCode 237 Delete Node in a Linked List
    Java类变量、实例变量的初始化顺序
  • 原文地址:https://www.cnblogs.com/zhupeng-1024/p/6050153.html
Copyright © 2011-2022 走看看