间隔与延迟:

间隔一段代码;

window.setInterval(“代码”,间隔执行秒数)

延迟一段时间后执行一段代码;

window.setTimeout(“执行代码”,延迟秒数(毫秒)).

对象

1.window.document;

docunment.getElement.ById(“id”)

根据id找到.一个

var a=docunment.getElementById("id")

将找到的元素放在,赋值变量中;

docunment.getElementByName(“名字name”)

找到名字.找出来为数组;

docunment.getElementByClassName(“名字name”)

根据class找到name.找出来的是数组

alert(a.innerText)

获取文字

a.innerHTML

将标签中的HTML代码和文字都获取

2.window.history

window.history.back();页面进行后退;

window.history.forward();页面进行前进

3.window.location

*location;地址栏

var s=window.location.href;获取当前页面的地址*

例;获取id;

<body>
<form>
输入<input type="text" id="ee" value="" />/*可输入文本框*/
<input type="button" onclick="aa()" value="点击" />/*当我点击的时候 */
</form>
</body>
</html>
<script>
function aa()
{
var b=document.getElementById("ee").value/*获取id,ee的value值*/
alert("值为"+b)/*输出*/
}
</script>

例;延迟按钮;

<body>
<form>
<input type="submit" id="b1" name="b1" value="提交(10)" disabled="disabled" />/*一个只能在10s后才可点击的按钮*/ </form>
</body>
</html>
<script>
var n=;
var a=document.getElementById("b1");/*根据id找到b1*/
function bian()
{
n--;
if(n==)
{
a.removeAttribute("disabled");
a.value="提交";
return;
}
else
{
a.value="提交("+n+")";
window.setTimeout("bian()",);}
}
window.setTimeout("bian()",);
</script>

DOM操作(Window.document对象)的更多相关文章

  1. JavaScript(四)——DOM操作——Window.document对象

    一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:    var a =docunment.getElementById(&qu ...

  2. JavaScript——DOM操作——Window.document对象

    一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:    var a =docunment.getElementById(&qu ...

  3. HTML中 DOM操作的Document 对象详解(收藏)

    Document 对象Document 对象代表整个HTML 文档,可用来访问页面中的所有元素.Document 对象是 Window 对象的一个部分,可通过 window.document 属性来访 ...

  4. JavaScript的DOM操作。Window.document对象

    间隔执行一段代码:window.setlnteval("需要执行的代码",间隔毫秒数) 例 :      window.setlnteval("alert("你 ...

  5. Window.document对象

    1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:     var a =docunme ...

  6. Window.document对象 轮播练习

    Window.document对象 一.找到元素:     docunment.getElementById("id"):根据id找,最多找一个:     var a =docun ...

  7. HTML Window.document对象

    1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:    var a =docunmen ...

  8. Window.document对象(1)

    1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:     var a =docunme ...

  9. JS中window.document对象

    小知识点注:外面双引号,里面的双引号改为单引号:                  在div里面行高设置和整个外面高度一样,才能用竖直居中,居中是行居中                  文本框取出来 ...

  10. 1、Window.document对象

    1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个:    var a =docunmen ...

随机推荐

  1. NLPP-02-Exercises

    <PYTHON自然语言处理>第2章 内容简介:各种文本语料库. 古腾堡项目 www.gutenberg.org OLAC元数据格式档 http://www.language-archive ...

  2. android Studio项目运行时报错“Could not identify launch activity: Default Activity not found”

    出现红色的小叉叉,有点蒙圈的感觉 其实只是因为AndroidManifest.xml里面没有设置运行初始的activity <activity android:name=".MainA ...

  3. dom相关指令

    1.ng-show  和 ng-hide 当ng-show=''true''的时候 dom会显示,反之隐藏,通过控制display属性 2.ng-if 当ng-if=“true” 的时候,dom显示, ...

  4. 洛谷P2014 选课 (树形dp)

    10月1日更新.题目:在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习.现在有N门功课,每门课有个学分 ...

  5. iOS中POST异步请求

    POST异步请求(代理) 1.遵循<NSURLConnectionDataDelegate> @interface ViewController ()<NSURLConnection ...

  6. Odoo report

  7. mybatis 打印sql 语句

    拦截器 package com.cares.asis.mybatis.interceptor; import java.text.DateFormat; import java.util.Date; ...

  8. struts2获取web元素的方式和方法

    获取web资源的方式按是否与servlet耦合可分为两种,再细分按照依赖方式又有两种即 依赖容器 和  依赖注入 什么是依赖容器 就是依赖  ActionContext或者ServletActionC ...

  9. UWP好文

    如何将GridViewEX升级到UWP(Universal Windows Platform)平台 : http://blog.csdn.net/powertoolsteam/article/deta ...

  10. Lucene.Net+盘古分词器(详细介绍)(转)

    出处:http://www.cnblogs.com/magicchaiy/archive/2013/06/07/LuceneNet%E7%9B%98%E5%8F%A4%E5%88%86%E8%AF%8 ...