一、弹出框

<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. UIKit-3347.44.2/UICollectionView.m:3443

    Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewC ...

  2. 根据IP定位获取城市代码

    public String getCityID() throws IOException{ URL url = new URL("http://61.4.185.48:81/g/" ...

  3. 支持多人协作的在线免费作图工具:ProcessOn

    之前朋友给我推荐一款作图工具ProcessOn,出于好奇我就研究了一下它,今天我就给大家简单介绍一下这款免费的在线作图工具:ProcessOn 首先使用ProcessOn我们需要有一个帐号,这样每次操 ...

  4. hql语句理解2

    /* * this.getSession().createQuery("sdfdf").executeUpdate();这里面的query可以是delete,update,inse ...

  5. viewController的自动扩展属性导致TableViewGroupStyle时向上填充

    self.automaticallyAdjustsScrollViewInsets = NO; 需设置这个属性

  6. JavaScript 之 走马灯

    1.原理分析:首先截取字符串的最后一位用Last表示,再截取剩余字符串用Rest表示,拼接字符串Last + Rest, 此事字符串是不会动的,还需要一个函数setInterval(javascrip ...

  7. FragmentActivity+FragmentTabHost+Fragement instead of TabActibvity+TabHost+Activity

    http://www.tuicool.com/articles/NzeMJz http://www.tuicool.com/articles/FJ7VBb FragmentTabHost切换Fragm ...

  8. 集合set的使用

    将无序对象储存在集合中 集合是类似于数组的一组对象,只是其中包含的项目是无序的(而数组是有序的).您通过枚举集合中的对象,或者将过滤器或测试应用到集合,来随机访问集合中的对象(使用 anyObject ...

  9. vijos 1779 国王游戏

    练了一下高精度..结果敲了这么久... #include<iostream> #include<cstdio> #include<cstring> #include ...

  10. C#泛型(二)

    <1>.泛型方法 以前文章说到用一个泛型类 SortHelper 来做一个冒泡排序的处理,下面回顾一下之前的代码: public class SortHelper<T> whe ...