一、弹出框

<script type="text/javascript">
    window.onload=function(){
         window.alert("msg alert");
         var msg =window.prompt("prompt", "hello"); //msg hello  或者null
         
         alert(msg);
         var msg1=window.confirm("hahah");  //msg1  true  false;
         alert(msg1);
         
         //alert prompt  confirm
         
    };
</script>

二、open

<script type="text/javascript">

function openW(){
   //定义自己的外观
   window.open("window2.html","mypage","width=500,height=500,titlebar=yes,resizable=yes",true);
}
</script>
  </head>
  <body>
      <input type="button" onclick="openW()" value="打开新窗体"/>
  </body>

三、window.setInterval

<script type="text/javascript">
//window.self属性  代表当前的窗体
//window.setInterval("函数名()",时间戳); 每隔时间戳 执行一次函数
var id=window.self.setInterval("clock()",1);
function clock(){
  var t=new Date();
  document.getElementById("clock").value=t;
}
 
function cls(){
    window.self.clearInterval(id);
}
</script>
  </head>
 
<body>
<!-- 输入框 -->
<input type="text" id="clock" size="35" />
<input type="button" value="清空操作" onclick="cls()"/>
</body>

四、window.setTimeout

<script type="text/javascript">
//window.self属性  代表当前的窗体
//window.setTimeout("函数名()",时间戳); 隔时间戳后 执行一次函数
var id=window.self.setTimeout("clock()",3000);
function clock(){
  var t=new Date();
  document.getElementById("clock").value=t;
  //id=window.self.setTimeout("clock()",3000);
}
 
function cls(){
   window.clearTimeout(id);
}

//面试题
</script>
  </head>
 
<body>

<!-- 输入框 -->
<input type="text" id="clock" size="35" />

<input type="button" value="清空操作" onclick="cls()"/>

</body>

五、Location

<script type="text/javascript">
  function goUrl()
  {
    
       alert(window.location.host);
     alert(window.location.hostname);
     alert(window.location.port);
     alert(window.location.protocol);
     alert(window.location.search);
      window.location.href="http://www.baidu.com";
      
  }
</script>
  </head>
 
  <body>
     <input type="button" value="发送新的请求" onclick="goUrl()"/>
  </body>

六、History

1.html

<body>
     <a href="2.html">进入2.html</a>
     
     <a href="./l.html?name=chj">进入l.html</a>
  </body>

2.html

<body>
   <!--  <a href="javascript:history.back()">返回1.html</a> -->
    <a href="javascript:history.go(-1)">返回1.html</a>
    <a href="3.html">进入3.html</a>
    <!-- <a href="javascript:history.forward()">前进</a> -->
    <a href="javascript:history.go(1)">前进</a>
  </body>

3.html

<body>
    This is my HTML page. <br>
    
   <!--  <a href="javascript:history.back()">返回2.html</a> -->
    <a href="javascript:history.go(-1)">返回12.html</a>
  </body>

JavaScript学习记录总结(十)——几个重要的BOM对象的更多相关文章

  1. JavaScript学习记录四

    title: JavaScript学习记录四 toc: true date: 2018-09-16 20:31:22 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...

  2. JavaScript学习记录三

    title: JavaScript学习记录三 toc: true date: 2018-09-14 23:51:22 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...

  3. JavaScript学习记录二

    title: JavaScript学习记录二 toc: true date: 2018-09-13 10:14:53 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...

  4. JavaScript学习记录一

    title: JavaScript学习记录一 toc: true date: 2018-09-11 18:26:52 --<JavaScript高级程序设计(第2版)>学习笔记 要多查阅M ...

  5. JavaScript学习笔记(四十四) 装饰器

    装饰器模式(Decorator) 在装饰器模式中,可以在运行时给一个对象动态的添加额外的功能.当和静态类打交道的时候(static classes),这可能是一个挑战.但在JavaScript中,对象 ...

  6. JavaScript -- 时光流逝(十二):DOM -- Element 对象

    JavaScript -- 知识点回顾篇(十二):DOM -- Element 对象 (1) element.accessKey: 设置或返回accesskey一个元素,使用 Alt + 指定快捷键 ...

  7. 诶西,JavaScript学习记录。。。。。。

    由于大学课程缘故,老师巨爱叫人问问题,还记分呢,随便记录一下Js的学习情况,以后复习什么的也比较方便吧...... 开始咯,就按照C语言学习那样的方法来吧! ===================== ...

  8. Javascript学习记录——原生JS实现旋转木马特效

    昨天学习到了JS特效部分,然后老师讲了旋转木马特效的实现,如上图.不过只是讲了通过点击箭头实现图片的切换,对于点击图片本身以及二者联动却是没有讲解. 本着一颗追求完美的心,今天花费了一个中午终于将整个 ...

  9. JavaScript学习记录总结(七)——dom对象应用之用户简单管理

    <!DOCTYPE html><html><head><title>users.html</title> <meta name=&qu ...

随机推荐

  1. android textview 跑马灯

    <TextView android:layout_width="match_parent" android:layout_height="48dp" an ...

  2. DotNetBar v12.9.0.0 Fully Cracked

    更新信息: http://www.devcomponents.com/customeronly/releasenotes.asp?p=dnbwf&v=12.9.0.0 如果遇到破解问题可以与我 ...

  3. ASIHTTPRequest 在release(打包)模式下数据获取或post失败问题

    ASIHTTPRequest 在relase模式下失效 表现为,调用网络请求后没有任何反应 原因之一: ARC模式下,在ASIHTTPRequest 前面会加上__weak来解决循环应用,这个__we ...

  4. HTTPS Everywhere – 保障隐私和信息安全的利器

    HTTPS Everywhere 是一款 Chrome 扩展程序,对于支持 HTTPS 的网站默认打开 HTTPS 加密传输来保障信息安全(HTTPS 介绍). HTTPS Everywhere 受到 ...

  5. 《使用this作为返回值的相关问题》

    //使用this作为返回值的相关问题: /* 如果在某个方法中把this作为返回值,则可以多次连续的调用同一个方法,从而使得代码 更加简洁,但是,这种把this作为返回值的方法可能造成实际意义的模糊, ...

  6. cf--2A

    //Accepted 100 KB 92 ms //模拟 #include <cstdio> #include <cstring> #include <iostream& ...

  7. zoj1530 bfs

    //Accepted zoj1530 270ms 40008KB #include <cstdio> #include <cstring> #include <iostr ...

  8. return, exit, _exit的区别

    return是返回的最常用的方式 _exit属于POSIX定义的系统调用 exit是GLIBC封装之后的函数 1 _exit和exit都会导致整个进程退出,清理进程所占用的资源,但是glibc封装ex ...

  9. Spring中配置文件applicationContext.xml配置详解

    <?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.spr ...

  10. IOS使用Asyncsocket进行socket编程

    iphone的标准推荐CFNetwork C库编程.但是编程比较烦躁.在其它OS往往用类来封装的对Socket函数的处理.比如MFC的CAsysncSocket.在iphone也有类似于开源项目.co ...