易截截图软件、单文件、免安装、纯绿色、仅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 字符串转换数字

方法主要有三种
转换函数、强制类型转换、利用js变量弱类型转换。
1. 转换函数
js提供了parseInt()和parseFloat()两个转换函数。前者把值转换成整数,后者把值转换成浮点数。只有对String类型调用这些方法,这两个函数才能正确运行;对其他类型返回的都是NaN(Not a Number)。
在判断字符串是否是数字值前,parseInt()和 ......

使用Javascript,CSS和Ajax创建ASP.NET自定义控件

在Visual Studio中,所有的ASP.NET 2.0控件都是自定义控件,创建自己的自定义控件一般需要完成以下三步。
(1)在站点APP_Code下创建一个新类;
(2)修改这个类,让它成为WebControl类(包含在System.Web.UI.WebControls命名空间)的派生类;
(3)重写基类(即WebControl类)的RenderContents()方法。
下面是一个最简单的ASP.NE ......

修复弹出JavaScript对话框时页面背景变白的问题

from http://niunan.javaeye.com/blog/248256
Page.ClientScript.RegisterStartupScript(Page.GetType(),"message", "<mce:script language='javascript' defer>alert('验证码输入错误!');</mce:script>"); ......

JavaScript toFixed() 方法

本文转自:http://www.w3school.com.cn/js/jsref_tofixed.asp
定义和用法
toFixed() 方法可把 Number 四舍五入为指定小数位数的数字。
语法
NumberObject.toFixed(num) 
参数num描述必需。规定小数的位数,是 0 ~ 20 之间的值,包括 0 和 20,有些实现可以支持更大的数值范围。如果省略了该参数,将用 0 代替。
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号