Prototype实战教程 5.$R

<!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>

时间: 2024-08-01 11:18:51

Prototype实战教程 5.$R的相关文章

Prototype实战教程 15.ObjectRange

<script src="prototype.js"></script> <div id="div1" style="font-size:20px;font-weight:bold"> ObjectRange </div> <script> var range = $R(1, 10, false); var range2 = $R(1, 10, true); alert(range.me

Prototype实战教程 14.Hash

<script src="prototype.js"></script> <script> // 创建一个对象 var obj = { key1: 1, key2: 2, key3: 3 }; // 将其转换为Hash对象 var hash = $H(obj); // 输出 #<Hash: {'key1': 1, 'key2' : 2, 'key3': 3}> // 输出key1=1&key2=2&key3=3 alert

Prototype实战教程 2.$A

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html> <head> <title>$A</title> <script language="javascript" src="prototype.js" type="text/javascript"&g

Prototype实战教程 8.顶层对象

<html> <head> <title>顶层元素</title> <script src="prototype.js"></script> <script> var Person=Class.create(); Person.prototype={ initialize:function(){}, name:'', birthday:'', age:'', Show:function(){alert(

Prototype实战教程 7.AJAX

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Ajax</title> <script type="text/javascript" langu

Prototype实战教程 6.$

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html> <head> <title>$</title> <script type="text/javascript" language="javascript" src="prototype.js" &g

Prototype实战教程 4.$H

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>$H</title> <script type="text/javascript" languag

Prototype实战教程 3.$F

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html> <head> <title>$F</title> <script type="text/javascript" language="javascript" src="prototype.js" &

Prototype实战教程 1.$$

<html> <head> <title>Test $$</title> <script src="prototype.js"></script> <script> function test$$(){ /**//* in case CSS is not your forte, the expression below says 'find all the INPUT elements that are