prototype1.4简介_yj
到一个 Array 对象。一个推荐的用法就是把 DOM Node Lists 转换成一个普通的 Array 对象,从而更有效率的进行遍历,请看下面的例子。
<script>
function showOptions(){
var someNodeList=$('lstEmployees').getElementsByTagName('option'); var nodes=$A(someNodeList); nodes.each(function (node){
alert(node.nodeName+': '+node.innerHTML); }); }
</script>
<selectid="lstEmployees" size="10">
<optionvalue="5">Buchanan,Steven</option> <optionvalue="8">Callahan,Laura</option> <optionvalue="1">Davolio,Nancy</option> </select>
<inputtype="button"value="Show the options"onclick="showOptions();">
2.4 使用$H() 函数
$H()函数把一些对象转换成一个可枚举的和联合数组类似的 Hash 对象。
<script>
function testHash() {
//let's create the object var a={
first:10,second:20,third:30 };
//now transform it into a hash
var h=$H(a);
alert(h.toQueryString());
//displays: first=10&second=20&third=30 }
</script>
2.5 使用$R()函数
$R()是 new ObjectRange(lowBound,upperBound,excludeBounds)的缩写。
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库prototype1.4简介_yj(5)在线全文阅读。
相关推荐: