Prototype - $H() 方法
$H() 函数将对象转换为类似于关联数组的可枚举 Hash 对象。
$H 函数是获取哈希的更简便方法。
语法
$H([obj])
返回值
哈希对象。
示例
<html> <head> <title>Prototype examples</title> <script type = "text/javascript" src = "/javascript/prototype.js"></script> <script> function ShowHash() { // 让我们创建对象 var a = {first: 10, second: 20, third: 30}; // 现在将其转换为哈希 var h = $H(a); alert( h.toQueryString()); } </script> </head> <body> <p>Click "Show Value" button to see the result</p> <form> <input type = "button" value = "Show Value" onclick = "ShowHash();"/> </form> </body> </html>
输出
prototype_utility_methods.html