返回到:Prototype – 实用方法
$H() 函数将对象转换为类似于关联数组的可枚举 Hash 对象。
$H 函数是获取散列的较短方法。
语法
$H([obj])
返回值
Hash对象。
例子
HTML
x
26
26
1
<html>
2
<head>
3
<title>Prototype examples</title>
4
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
5
6
<script>
7
function ShowHash() {
8
// let's create the object
9
var a = {first: 10, second: 20, third: 30};
10
11
// now transform it into a hash
12
var h = $H(a);
13
alert( h.toQueryString());
14
}
15
</script>
16
</head>
17
18
<body>
19
<p>Click "Show Value" button to see the result</p>
20
21
<form>
22
<input type = "button" value = "Show Value" onclick = "ShowHash();"/>
23
</form>
24
25
</body>
26
</html>
返回到:Prototype – 实用方法
阅读剩余 78%
作者:terry,如若转载,请注明出处:https://www.web176.com/prototype_api/8948.html