javascript里的document.all用法
1
、理解document.all
[]
从IE4开始IE的object
model才增加了document.all
[],来看看document.all
[]的Description:
Array
of all HTML tags in the document.Collection of all elements contained by the
object.
也就是说document.all
[]是文档中所有标签组成的一个数组变量,包括了文档对象中所有元素(见例1)。
IE’s
document.all
collection exposes all document elements.This array provides access to every
element in the document.
document.all
[]这个数组可以访问文档中所有元素。
例1(这个可以让你理解文档中哪些是对象)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Document.All
Example</title>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1" />
</head>
<body>
<h1>Example
Heading</h1>
<hr />
<p>This is a
<em>paragraph</em>. It is only a
<em>paragraph.</em></p>
<p>Yet another
<em>paragraph.</em></p>
<p>This final
<em>paragraph</em> has <em id="special">special
emphasis.</em></p>
<hr />
<script
type="text/javascript">
<!--
var i,origLength;
origLength =
document.all
.length;
document.write('document.all
.length='+origLength+"<br
/>");
for (i = 0; i < origLength;
i++)
{
document.write("document.all
["+i+"]="+document.all
[i].tagName+"<br
/>");
}
//-->
</script>
</body>
</html>
输出结果:
Example Heading
This is a paragraph
. It is only a paragraph.
Yet another paragraph.
This final paragraph
has special
emphasis.
< type="text/javascript">
<!--
var i,origLength;
origLength = document
相关文档:
javascript中window对象的方法和属性资料
引用:http://www.cnblogs.com/Athrun/archive/2008/04/16/1156291.html
Window对象是客户端javascript最高层对象之一,只要打开浏览器窗口,不管该窗口中是否有打开的网页,当遇到BODY、FRAMESET或FRAME元素时,都会自动建立window对象的实例。另外,该对象的实例也可由wi ......
在 JS(JavaScript) 操作cookies比较复杂,在 ASP 里面我们只需要知道 cookie 的名称、cookie 的值就行了,而 JS 里面,我们面对的是 cookie 的字符串,你自己编写这个字符串写入客户端,然后自己解析这个字符串。
一、从写 cookie 说起。
var the_date = new Date("December 31, 2020");
var expiresDate ......
.XML Web services 行为使客户端脚本能够调用由 Microsoft .NET XML Web services 或其他支持简单对象访问协议 (SOAP) 的 Web 服务器公开的远程方法。
目的:提供一种简单的方法使用和利用 SOAP,而不需具有 SOAP 实现的专业知识。
步骤:
1.下载Webservice.htc,许多网上的文章介绍该文件可以在微软的网站上找到,但我按 ......
最近的项目开发中 遇到一些需要根据具体情况动态添加javaScript脚本,然后执行脚本 于是收集了一下:
1 在控件的绑定事件中添加脚本 如:在gridview控件的rowdatabind事件中可以实现 指针的选中行不同色显示 可添加脚本
protected void gvEngineerRepairState_RowDataBound(object sender, GridViewRowEventArgs e ......