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

Prototype实战教程----5.$R

 2010-09-14 13:10:28 来源: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>$R</title>
    <script type="text/javascript" language="javascript"
     src="prototype.js" ></script>
    <script>
    // 依次输出1,2,3,4
    function test_R1(){
      var range = $R(1, 5, true);
      range.each(function(value, index){
        alert(value);
      });
    }
  
    // 依次输出1,2,3,4,5
    function test_R2(){
      var range = $R(1, 5, false);
      range.each(function(value, index){
        alert(value);
      });
    }
    </script>
  </head>
  <body>
    <form>
      <input type="button" value="click (exclusive = true)"
      onclick="test_R1()" />
      <input type="button" value="click (exclusive = false)"
      onclick="test_R2()" />
    </form>
  </body>
</html>

Tags:Prototype 实战 教程

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