Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var d1 = [{"text": "Wang jiawan", "value": "9" },{ "text": "Li jiawan", "value": "10 "}, {"text": "Shao jiawan", "value": "13"}];
$ (D1). each (function (){
Alert (this. text + "" + this. value );
});
</Script>
No JQuery
Copy codeThe Code is as follows:
<Script type = "text/javascript">
Var json = {"options": "[{\" text \ ": \" wangjiawan \ ", \" value \ ": \" 9 \"}, {\ "text \": \ "Li jiawan \", \ "value \": \ "10 \" },{ \ "text \": \ "Shao jiawan \", \ "value \": \ "13 \"}] "}
Json = eval (json. options)
For (var I = 0; I <json. length; I ++)
{
Alert (json [I]. text + "" + json [I]. value)
}
</Script>
Js traversal json Array
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> New Document </TITLE> <meta name = "Generator "CONTENT =" EditPlus "> <meta name =" Author "CONTENT =" "> <meta name =" Keywords "CONTENT =" "> <meta name =" Description "CONTENT = ""> </HEAD> <BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]