• javascript常用对象


    A,window对象

      window对象是浏览器模型对象的顶层对象

    1.   常用属性:

        screen:客户端的屏幕和显示性能的信息。

        history:客户端访问过的url信息

        location:当前url链接的信息

      2.  常用方法:

        alert:提示框

        close:关闭浏览器窗口

        prompt:显示可提示用户输入的对话框。

        用法:

    //第二个参数为用户输入的值,可以有默认值,为空的话,会弹出null,
    var result= prompt("请输入",“”);
    alert(result);

        confirm:显示带有提示信息,确定和取消按钮的对话框

        用法:

    //确定返回true,取消返回false
    var result=confirm("是否删除?");

        open:打开新窗口,加载制定url,或者页面

        open("弹出窗口的url","窗口名称","窗口特征");

        窗口特性

    //height    width窗口文档显示区的高度宽度,以像素记
    //left    top窗口的x轴,y轴
    //toolbar=yes|no|1|0    是否显示浏览器工具栏,默认是
    //scrollbar=yes|no|1|0    是否显示滚动条,默认是
    //location=yes|no|1|0    是否显示地址栏,默认是
    //status=yes|no|1|0    是否显示状态栏,默认是
    //menubar=yes|no|1|0    是否显示菜单栏,默认是
    //resizable=yes|no|1|0    窗口是否可调节尺寸,默认是
    //titlebar=yes|no|1|0    是否显示标题栏,默认是
    //fullscreen=yes|no|1|0    是否使用全屏模显示浏览器式,默认no

        用法:

    window.open("index.html","","height=30,fullscreent=no");

      3,  常用事件

        1,onload:一个页面或者一幅图像加载完成

        2,onmouseover:鼠标移动到某元素上

        3,onclick:鼠标单击事件

        4,onkeydown:键盘按键被按下

        5,onchange:作用域内容被改变

    B,定时函数

      1,setTimeout():只执行一次

        用法:

    //页面加载后一秒,只提示一次窗口
    setTimeout("alert('这是提示')",1000);

      2,seInterval():循环多次执行

        用法:

    //页面加载后每过一秒,提示一次窗口
    seInterval("alert('这是提示')",1000);

    C:document对象

      常用属性

        referrer:返回进入当前页面的前一个页面的url

        URL  :返回当前文档的url

        如果当前页面不是通过超链接访问过来的,document.referrer的值就会为null

        用法:

    <script type="text/javascript">
        var result=document.referrer;
        if(result=="")
         {
            document.write("<h2>不是从原页面访问的本页面,将去登录");
            setTimeout("javascript:location.href='login.apsx'",5000);
    }
    </script>

      常用方法:

        getElementById('id')  返回指定id的第一个对象

        getElementByName('')  返回指定名称(标签的name属性)的对象的集合

        getElementByTagName('')  返回带有指定标签名的对象的集合

        write('')  向文档写文本,html,或者javascript

        

  • 相关阅读:
    新闻发布项目——接口类(newsTbDao)
    Möbius strip
    The Apache Thrift API client/server architecture
    可以执行全文搜索的原因 Elasticsearch full-text search Kibana RESTful API with JSON over HTTP elasticsearch_action es 模糊查询
    SciDB
    build a real-time analytics dashboard to visualize the number of orders getting shipped every minute to improve the performance of their logistics for an e-commerce portal
    Kafka monitoring Kafka dashboard
    redundant array of independent disks
    the algebra of modulo-2 sums disk failure recovery
    define tensorflow and run it
  • 原文地址:https://www.cnblogs.com/valiant1882331/p/4864092.html
Copyright © 2020-2023  润新知