易截截图软件、单文件、免安装、纯绿色、仅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 中使用 replace 达到 replaceAll的效果

方法: string.replace(new RegExp(oldString,"gm"),newString))
gm  g=global, m=multiLine,大致上方法就是这样的,可以实现替换全部指定字串
另一个简单的验证JS的方法:
在浏览器地址栏输入
javascript:alert("abcabcabc".replace(new RegExp("a","gm"),"ad&quo ......

JavaScript实现中文转拼音

1、问题背景:
在做项目时候遇到一个小小的显示客户部门名称(拼音)的业务,就是在部门名称下有相应的拼音,而在现有的数据库中没有相应字段,并且部门数量比较多,添加起来比较费时,就想能否在js中实现,在页面中处理。
2、原理描述
程序原理很简单,网上可以找到汉字拼音的数据字典,但是由于大家都知道GB2312编码里 ......

javascript操作cookies 以及正确使用cookies的属性

在 JS(JavaScript) 操作cookies比较复杂,在 ASP 里面我们只需要知道 cookie 的名称、cookie 的值就行了,而 JS 里面,我们面对的是 cookie 的字符串,你自己编写这个字符串写入客户端,然后自己解析这个字符串。
  一、从写 cookie 说起。
var the_date = new Date("December 31, 2020");
var expiresDate ......

JavaScript键盘

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

Javascript 语法讲解

1.delete 运算符
对象删除一个属性,或数组中删除一个元素。将无用的内容删除以节省空间。
delete expression
example:
  var person = new Object();
  person.sex = "male";
  alert(person.sex);
  delete person.sex;
  alert(person.sex);
2. ‘,' 运算符
  var a = 2; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号