DOM操作(Window.document对象)
间隔与延迟:
间隔一段代码;
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对象)的更多相关文章
- JavaScript(四)——DOM操作——Window.document对象
一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunment.getElementById(&qu ...
- JavaScript——DOM操作——Window.document对象
一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunment.getElementById(&qu ...
- HTML中 DOM操作的Document 对象详解(收藏)
Document 对象Document 对象代表整个HTML 文档,可用来访问页面中的所有元素.Document 对象是 Window 对象的一个部分,可通过 window.document 属性来访 ...
- JavaScript的DOM操作。Window.document对象
间隔执行一段代码:window.setlnteval("需要执行的代码",间隔毫秒数) 例 : window.setlnteval("alert("你 ...
- Window.document对象
1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunme ...
- Window.document对象 轮播练习
Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docun ...
- HTML Window.document对象
1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunmen ...
- Window.document对象(1)
1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunme ...
- JS中window.document对象
小知识点注:外面双引号,里面的双引号改为单引号: 在div里面行高设置和整个外面高度一样,才能用竖直居中,居中是行居中 文本框取出来 ...
- 1、Window.document对象
1.Window.document对象 一.找到元素: docunment.getElementById("id"):根据id找,最多找一个: var a =docunmen ...
随机推荐
- openLDAP
错误提示: D:\OpenLDAP>slapd -d 256 515a48ae OpenLDAP 2.4.34 Standalone LDAP Server (slapd)515a48af co ...
- fastjson基本使用 (待大量完善)
参考: http://blog.csdn.net/wx_962464/article/details/37612861 maven库下载 fastjson基本使用 import java.util.A ...
- 用python监控Linux,CPU,内存,硬盘
#!/usr/local/bin/python3.5 #coding:utf-8 import mailll, linecache, re, socket, os, time hostname = s ...
- Tornado 异步客户端
前言 Tornado是很优秀的非阻塞式服务器,我们一般用它来写Web 服务器,据说知乎就是用Tornado写的. 如果对tornado源码不是很了解,可以先看一下另一篇文章: http://yunji ...
- java多线程学习-同步(synchronized)
(示例都是网上视频的) 假如两个线程同时调用一个方法输出字符串 public class SynchronizedTest extends Thread { public static void ma ...
- 三级设置页面管理测试demo
#include "PhoneBookWindow.h"#include "xWindow/xWindow.h"#include "hardwareD ...
- ios8以后,使用UIAlertViw时pop/push页面后,键盘闪一下的问题
代码为 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"感谢你对我们提出的意见或 ...
- linux 系统下,如何清空文件内容
最近用 crontab命令 做了一些 同步任务,可后期同步任务的代码没用了,于是,我就直接删除了 代码(对应的jar包),但是 crontab -e 的命令行没有删除 ,以后,每天我的Azure vm ...
- 简易版CMS后台管理系统开发流程
目录 简易版CMS后台管理系统开发流程 MVC5+EF6 简易版CMS(非接口) 第一章:新建项目 MVC5+EF6 简易版CMS(非接口) 第二章:建数据模型 MVC5+EF6 简易版CMS(非接口 ...
- Wpf 中使用gif格式的动态图
第一种方法:使用winform插件 <WindowsFormsHost xmlns:wf="clr-namespace:System.Windows.Forms;assembly=S ...