Prototype框架学习$H()函数

<%@ 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>
   
    <script type="text/javascript">
    var a ="hello";
    var nav = $H(a);
    alert(nav.inspect());
   
   
    </script>
    <!-- $H()这个函数是用于将对象转换成Hash对象.类似JAVA中的MAP结构.由一系列的KEY-VALUE组成 -->
    <script type="text/javascript">
    function testH(){
    var a={
    one: 10,
    two: 20,
    three:30
    };
   
    var h = $H(a);
    alert(h.toQueryString());
    }
    </script>
    <title>prototype学习</title>
   


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

你可能感兴趣的:(prototype)