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 ...
随机推荐
- CSS3 中的 rem 值与 px 之间的换算
想给博客换个主题,到处找找不到满意的,最后发现默认主题 twentytwelve 越看越顺眼,于是就想动手改一下用. 看 CSS 文件的时候发现引入了一个新大小单位:rem,虽然 CSS 文件注释里有 ...
- globals()
[globals() ] globals() Return a dictionary representing the current global symbol table. This is alw ...
- 【POJ2949】Word Rings(最大平均值环)
题意:给定N个字符串,如果A串的最后两个字母跟B串的前两个字母相同它们就能连接. 求一个由字符串组成的首尾相连的环,使(字符串总长度/字符串个数)最大. n<=100000 len<=10 ...
- LeetCode OJ 150. Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, ...
- JS之延迟处理
$(document).ready(function () { $("#zidong3,#zidong1").click(function () { $("#zidong ...
- 技术英文单词贴--C
C category 种类,分类,范畴 cols 列数目 comma 逗号 component 组件,部件,成分 configure 配置,安装 configuration 配置,布局,构造 cons ...
- ios8以后,使用UIAlertViw时pop/push页面后,键盘闪一下的问题
代码为 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"感谢你对我们提出的意见或 ...
- AsyncTask源码分析
在Android中,主线程是UI线程,当需要根据其他数据进行更新UI时,如果获取数据的操作比较耗时的话,会触发ANR,所以我们应该讲耗时的操作进行异步操作,尤其是请求网络数据的操作应该放在后台线程进行 ...
- 問題排查:.NETSystem.Runtime.Remoting.RemotingException: TCP 信道协议冲突: 应为报头。
這個錯誤訊息是在一個 Web Serveice 的偵錯階段發生的 目前還未找到原因,環境如下: 作業系統:Windows 10 x64 企業版 (簡中) 開發工具:Visual Studio 2013 ...
- 利用Access-Control-Allow-Origin响应头解决跨域请求
//允许任何域名访问 header("Access-Control-Allow-Origin: *"); //指定域名允许跨域 header("Access-Contro ...