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=张三
  • 相关阅读:
    小心SQL SERVER 2014新特性——基数评估引起一些性能问题
    SQL SERVER使用ODBC 驱动建立的链接服务器调用存储过程时参数不能为NULL值
    Windows Server 2012 Recycle Bin corrupted
    SQL SERVER CHAR ( integer_expression )各版本返回值差异的案例
    SQL Server 2008 R2 升级到 Service Pack 3后Report Builder启动不了
    MySQL如何导出带日期格式的文件
    ORACLE TO_CHAR函数格式化数字的出现空格的原因
    Linux监控工具介绍系列——smem
    Linux命令学习总结:dos2unix
    Linux命令学习总结:hexdump
  • 原文地址:https://www.cnblogs.com/zhupeng-1024/p/6050153.html
Copyright © 2011-2022 走看看