forked from jackieli123723/JavaScript.Utilities
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionaryDemo.aspx
More file actions
43 lines (40 loc) · 1.4 KB
/
dictionaryDemo.aspx
File metadata and controls
43 lines (40 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="dictionaryDemo.aspx.cs" Inherits="YanZhiwei.JavaScript.Utilities.dictionaryDemo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src=/proxy/https/github.com/JavaScriptExample/JavaScript.Utilities/blob/master/YanZhiwei.JavaScript.Utilities/"dictionary.js"></script>%3C/div>
<script>
function dictionaryToArrayTest() {
var _dic = new dictionary();
_dic["2"] = "bb";
_dic["4"] = "dd";
_dic["1"] = "aa";
_dic["3"] = "cc";
var _array = _dic.toArray();
for (var i = 0; i < _array.length; i++) {
console.log(_array[i])
}
}
function dictionaryforInTest() {
var _dic = new dictionary();
_dic["2"] = "bb";
_dic["4"] = "dd";
_dic["1"] = "aa";
_dic["3"] = "cc";
_dic.forIn(function (key, value) {
console.log("key:" + key + " Value:" + value)
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button8" type="button" value="DictionaryToArray" onclick="dictionaryToArrayTest()" /><br />
<input id="Button9" type="button" value="DictionaryforInTest" onclick="dictionaryforInTest()" /><br />
</div>
</form>
</body>
</html>