WEB开发网
开发学院网页设计JavaScript Prototype实战教程----2.$A 阅读

Prototype实战教程----2.$A

 2010-09-14 13:10:34 来源:WEB开发网   
核心提示:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>&l

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
  <title>$A</title>
  <script language="javascript" src="prototype.js"
   type="text/javascript"></script>
  <script language="javascript" type="text/javascript">
  function showOptions() {
    var someNodeList = $("lstFramework").getElementsByTagName("option");
    var nodes = $A(someNodeList);
    
    var info = [];
    
    nodes.each (function(node){
      info.push(node.value + ": " + node.innerHTML);
    });
    
    alert(info.join("rn"));
  }
  </script>
</head>
<body>
  <form>
    <select id="lstFramework" size="10">
      <option value="1">Prototype</option>
      <option value="2">Script.aculo.us</option>
      <option value="3">Dojo</option>
      <option value="4">YUI</option>
    </select>
    <input onclick="showOptions();" type="button" value="Show the options">
  </form>
</body>
</html>

Tags:Prototype 实战 教程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接