1.
Copy Code code as follows:
<script type= "Text/javascript" >
by Go_rush (cloud-dwelling community) from http://www.jb51.net/
var hash={
"Baidu": "http://www.baidu.com/",
"Google": "http://www.google.com/",
"Microsoft": "http://www.microsoft.com/",
"Cloud-dwelling Community": "http://www.jb51.net/"
};
function Showurl (Element) {//Use Ha Dilute object
Alert (Hash[element.value])
}
</script>
<body>
<form>
<input type= "text" id= "txt"/>
<input type= "button" value= "Test" onclick= "Showurl (document.getElementById (' txt '));" />
</form>
</body>
2.
Copy Code code as follows:
<script>
var ht =
{
"C1": {"UserID": "Userc1", "UserName": "Usercc1"},
"C2": {"UserID": "Userc2", "UserName": "Usercc2"},
"C3": {"UserID": "Userc3", "UserName": "USERCC3"}
};
Alert (ht["C1"] ["UserID"]);
Alert (ht["C2"] ["UserID"]);
</script>
3
Copy Code code as follows:
<script>
var Arr =new Array ({' s ': ' sss ', ' AA ': ' www '},{' s1 ': ' wwww ', ' Aa1 ': ' SSSs '});
alert (ARR[0].S);
alert (ARR[0].AA);
alert (ARR[1].S1);
alert (ARR[1].AA1);
</script>