间隔与延迟:

间隔一段代码;

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. javascript中的innerHTML是什么意思,怎么个用法?

    innerHTML在JS是双向功能:获取对象的内容 或 向对象插入内容:如:<div id="aa">这是内容</div> ,我们可以通过 document ...

  2. gradle教程 [原创](eclipse/ADT下 非插件 非Android Studio/AS)纯手打 第一篇:安装配置gradle

    一个bug 一个脚印的叫你们用gradle. 1介于网络上的很多资料都是老的 不适用与现在的新版本gradle 尤其是有些gradle方法改名了老的用不了 2介于网上都是粘贴复制并且零碎我很蛋疼啊,走 ...

  3. POJ 1113 - Wall 凸包

    此题为凸包问题模板题,题目中所给点均为整点,考虑到数据范围问题求norm()时先转换成double了,把norm()那句改成<vector>压栈即可求得凸包. 初次提交被坑得很惨,在GDB ...

  4. 点亮一个led灯

    /********************************* 代码功能:点亮一个led灯 使用函数: pinMode(引脚号,模式); digitalWrite(引脚号,电平状态); //默认 ...

  5. 【随笔】vmstat性能监测

    vmstat命令是最常见的Linux/Unix监控工具,可以展现给定时间间隔的服务器的状态值,包括服务器的CPU使用率,内存使用,虚拟内存交换情况,IO读写情况.相比top,vmstat可以看到整个机 ...

  6. mormot THttpApiServer使用例子

    mormot THttpApiServer使用例子 THttpApiServer封装了WINDOWS的HTTPS.SYS. unit Unit1; interface uses Winapi.Wind ...

  7. How to Use JUnit With JMeter

    Do you need to use JUnit in your testing processes? To answer this question, let's take a look first ...

  8. c#开发Mongo笔记第三篇

    今天主要测试了一下查询功能了,当然了主要还是为了让查询可以和我们平时使用的实体对象关联起来,并且 那些BsonDocument和Collection我们操作起来不是太方便的 还是首先定义了一个用户类, ...

  9. JS调用BHO

    // BHO 中添加下面的函数,设置UIHandler// BHO 包含如下成员变量: // CDocDispatch m_docDispatch;// CComPtr<IDocHostUIHa ...

  10. Oracle中的带参数的视图--我们致力于打造人力资源软件

    创建包和包体 create or replace package pkg_pv is procedure set_pv(pv varchar2); function get_pv return var ...