JSON的一个简单例子时间:2021-04-19 03:13:58<! 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 ="" > < script language ="javascript" > var myJson = {"myJson":{"name":"hello world"}}; function hello(myObject) { document.getElementById('myResults').innerHTML = myObject.myJson.name; } </ script > </ HEAD > < BODY > < a href ='javascript:void(0)' id ="myTrigger" onclick ="javascript:hello(myJson)" > click me </ a > < div id ="myResults" > results go here </ div > </ BODY > </ HTML > 运行这个网页,之前: 运行后: