- 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
廣告