Prototype框架学习$R()函数

<%@ page language="java" import="java.util.*" contentType="text/html; charset=gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <!-- 引入Prototype.js-->
    <script type="text/javascript" src="prototype-1.4.0.js">
    </script>
    <!-- $R()函数是用来枚举对象里面的元素.each这个方法是用来遍历对象中的每个元素 -->
    <script type="text/javascript" >
    function testR(){
    var range=$R(10,20,false);
    range.each(function(value,index){
   
    alert(value)});
   
    }
   
    </script>
    <title>prototype学习</title>
   


  </head>
 
  <body>
    <input type="button" onclick="testR()" value="测试$R()函数">
</body>
</html>

你可能感兴趣的:(prototype)