- Prototype 教程
- Prototype - 首页
- Prototype - 简要概述
- Prototype 的优点
- Prototype - 实用方法
- Prototype - 元素对象
- Prototype - 数字处理
- Prototype - 字符串处理
- Prototype - 数组处理
- Prototype - 哈希处理
- Prototype - 基本对象
- Prototype - 模板
- Prototype - 列举
- Prototype - 事件处理
- Prototype - 表单管理
- Prototype - JSON 支持
- Prototype - AJAX 支持
- Prototype - 表示范围
- Prototype - 定期执行
- Prototype 的实用资源
- Prototype - 快速指南
- Prototype 的实用资源
- Prototype - 讨论
prototype - $H() 方法
$H () 函数将对象转换为类似于关联数组的可枚举哈希对象。
$H 函数是一种更简洁的方法,用于获取哈希对象。
语法
$H([obj])
返回值
哈希对象
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function ShowHash() {
// let's create the object
var a = {first: 10, second: 20, third: 30};
// now transform it into a hash
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.htm
广告