javaScript获取对象集合(另一种方法)
除了用getElementByTagName 的另一种获取对象集合的方法
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="one" name="one">
<input type="text" title="sadf" sd="sdf" name="hello" id="hello" value="1" />
<input type="text" name="hello" sd="sasdfasdf" id="hello" value="2" />
<input type="text" name="hello" id="hello" value="3" />
<input type="text" name="hello" id="hello" value="4" />
<input type="text" name="hello" id="hello" value="5" />
<input type="text" name="hello" id="hello" value="6" />
<input type="text" name="hello" id="hello" value="7" />
<input type="text" name="hello" id="hello" value="8" />
<input type="button" name="ss" value="44" onclick="javascript:ss();" />
</form>
<mce:script type="text/javascript" language="javascript"><!--
function ss(){
var ss = getFiles();
alert(ss[1].sd);
}
function getFiles(){
var files = new Array();
var inputs = document.getElementsByTagName("input");
for(var i=0;i<inputs.length;i++)
{
files[i] = inputs[i];
}
return files;
}
window.onload=ss;
// --></mce:script>
</body>
</html>
相关文档:
Working Around Caching Issues 关于缓存问题
Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......
在javascript中得到当前窗口的高和宽
<body><SCRIPT LANGUAGE="JavaScript">
var s = "";
s += "\r\n网页可见区域宽:"+ document.body.clientWidth;
s += "\r\n网页可见区域高:"+ document.body.clien ......
JSON:
[{"subjecttypeId":"1","subjectName":"67","scope":"1",},{"subjecttypeId":"1","subjectName":"345","scope":"1"}]
JavaScript:
var result = window.eval('(' + JSON+ ')');
for(var p in result){
result[p].subjectName;
alert(result[p] ......
1. Javascript Debug Toolkit介绍
JSDT(Javascript Debug Toolkit)是一个用于javascript调试的eclipse
插件,用于调试javascript。JSDT可以跨浏览器调试,支持在IE,Firefox,Safari,Chrome等主流浏览器中调试
javascript。JSDT支持设置断点,单步调试等调试工具的基本特性。
2. 如何安装
JSDT是基于eclipse3.2+,jdk1.5+ ......
使用过ajax的都常见这样的代码:
<a href="javascript:doTest2();void(0);" mce_href="javascript:doTest2();void(0);">here</a>
但这儿的void(0)究竟是何含义呢?
Javascript中void是一个操作符,该操作符指定要计算一个表达式但是不返回值。
void 操作符用法格式如下:
1. jav ......