间隔与延迟:

间隔一段代码;

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. args

    java 中args一般存在main主类方法内,String args[ ]或者String[ ] args表示给主方法传一个字符串数组. 而args是一个字符串数组的变量名,不是关键字,是argum ...

  2. JQuery Mobile 页面参数传递(转)

    在单页模版中使用基于HTTP的方式通过POST和GET请求传递参数,而在多页模版中不需要与服务器进行通信,通常在多页模版中有以下三种方法来实现页面间的参数传递. 1.GET方式:在前一个页面生成参数并 ...

  3. R语言学习笔记-变量的作用域

    R语言是如何将变量值和变量绑定的 在r语言中,当前的 workspace就是global enviroment,当输入变量名时,首先会在global enviroment中搜索该变量,如有,则将它显示 ...

  4. 对div作用域的理解

    若想要div的height起作用,则要保证它上面的层的height也是有用的,如上图

  5. 爬虫--scrapy--windows上安装

    关于scrapy的安装网上有一大把教程,但是比较麻烦,各种包----------,这里给大家介绍一款神器: 下载地址:http://continuum.io/downloads 根据自己电脑的系统选择 ...

  6. linux--杂记(rework)

    1.The mind behind Linux https://www.ted.com/talks/linus_torvalds_the_mind_behind_linux 2.Emacs ORG-M ...

  7. stream_copy_to_stream的使用

    stream_copy_to_stream - 在数据流之间进行复制操作 例子: <?php //读写方式 $stream = fopen('php://temp', 'w+'); //如果成功 ...

  8. python安装pycrypto报错error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    系统3.19.0-15-generic #15-Ubuntu 安装pycrypto提示error: command 'x86_64-linux-gnu-gcc' failed with exit st ...

  9. DIV布局-高度不同DIV,自动换行并对齐

    最近弄了一个动态添加div框,每个div框内容有多有少,要支持div高度自适应,还要添加的div自动追加,并且换行还要保持每行对齐. 刚开始的效果: 要改啊,搞不定,问了UI高手,终于给出了完美解决方 ...

  10. GNU M4 - GNU Project - 免费软件基金会(FSF)

    -------------------------------------------------------------------------------------- GNU M4介绍: GNU ...