易截截图软件、单文件、免安装、纯绿色、仅160KB

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验证表单函数大全

 <script>
/*
用途:校验ip地址的格式
输入:strIP:ip地址
返回:如果通过验证返回true,否则返回false;
*/
function isIP(strIP) {
if (isNull(strIP)) return false;
var re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/g //匹配IP地址的正则表达式
if(re.test(strIP))
{
if( RegExp.$1 <256 &am ......

Javascript时间差计算函数

JavaScript时间差计算函数
<mce:script language="javascript"><!--
Date.prototype.dateDiff = function(interval,objDate){
//若參數不足或 objDate 不是日期物件則回傳 undefined
if(arguments.length<2||objDate.constructor!=Date) return undefined;
......

ie的javascript语句失效修复方法

2007-01-20 01:01
ie的javascript失效了,不是设置的问题
折腾了一晚上终于在水木上找到答案了,经过试验成功了。感谢这位haning。也希望转载之后,这篇文章能帮助更多的人。
================================================
发信人: haning (柏寒宇), 信区: Virus
标  题: KAV6.0使javascript语句失效修复方法 ......

JavaScript键盘

JavaScript键盘事件侦听
在使用JavaScript做WEB键盘事件侦听捕获时,主要采用onkeypress、onkeydown、onkeyup三个事件进行出来。该三个事件的执行顺序如下:onkeydown -> onkeypress ->onkeyup。在一般情况下,采用三种键盘事件均可对键盘输入进行有效的响应。当在实际使用中,会发现这几者有些不同的差别。
  ......

400多个JavaScript特效大全

400多个JavaScript特效大全,包含全部源代码和详细代码说明,不可多得
JavaScript实现可以完全自由拖拽的效果,带三个范例     http://www.sharejs.com/showdetail-501.aspx 
javascript实现可以自由拖动的树形列表     http://www.sharejs.com/showdetail-500.aspx  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号