📄 分析json_js(注释) - 网站 学习 - 博客园.mht
字号:
<P> =
//=E5=9C=A8=E5=BC=80=E7=AF=87=E4=B8=AD=E6=8F=90=E5=88=B0=E7=9A=84=E6=8A=8A=
=E6=96=B9=E6=B3=95=E9=9B=86=E4=B8=AD=E8=B5=B7=E6=9D=A5=E7=9A=84=E6=96=B9=E6=
=B3=95<BR> (function (s)=20
{<BR> var m=20
=3D<BR> =20
{<BR> =
'\b':=20
'\\b',<BR> &nb=
sp;=20
'\t':=20
'\\t',<BR> &nb=
sp;=20
'\n':=20
'\\n',<BR> &nb=
sp;=20
'\f':=20
'\\f',<BR> &nb=
sp;=20
'\r':=20
'\\r',<BR> &nb=
sp; '"'=20
: =
'\\"',<BR> &nb=
sp;=20
'\\': '\\\\'<BR> };</P>
<P> s.parseJSON =3D function =
(hook)=20
{<BR> =
try=20
{<BR> &n=
bsp; =20
if (/^("(<A=20
href=3D'file://.:[%255E%2522///n/r])*?"|[,:{}/[/]0-9./-+Eaeflnr-u'>file:/=
/.:[%255E%2522///n/r])*?"|[,:{}/[/]0-9./-+Eaeflnr-u</A>\n\r\t])+?$/.<BR>&=
nbsp; &n=
bsp; =20
test(this))=20
{<BR> &n=
bsp; =20
var j =3D eval('(' + this +=20
')');<BR> &nbs=
p; =20
if (typeof hook =3D=3D=3D 'function')=20
{<BR> &n=
bsp; =20
function walk(v)=20
{<BR> &n=
bsp; &nb=
sp; =20
if (v && typeof v =3D=3D=3D 'object')=20
{<BR> &n=
bsp; &nb=
sp; =20
for (var i in v)=20
{<BR> &n=
bsp; &nb=
sp; =20
if (v.hasOwnProperty(i))=20
{<BR> &n=
bsp; &nb=
sp; &nbs=
p; =20
v[i] =3D=20
walk(v[i]);<BR> &nbs=
p;  =
; =
=20
}<BR> &n=
bsp; &nb=
sp; =20
}<BR> &n=
bsp; &nb=
sp; =20
}<BR> &n=
bsp; &nb=
sp; =20
return=20
hook(v);<BR> &=
nbsp; &n=
bsp;=20
}<BR> &n=
bsp; =20
return=20
walk(j);<BR> &=
nbsp; =20
}<BR> &n=
bsp; =20
return=20
j;<BR> &=
nbsp; =20
}<BR> =
} catch=20
(e) =
{<BR> =20
}<BR> =
throw=20
new =
SyntaxError("parseJSON");<BR> =20
};</P>
<P> s.toJSONString =3D =
function ()=20
{<BR> =
if=20
(/["<A>\\\x00-\x1f]/.test(this</A>))<BR> &nb=
sp; =20
{<BR> &n=
bsp; =20
return<BR> &nb=
sp; =20
'"'=20
+<BR> &n=
bsp; =20
this.replace(/([\x00-\x1f\\"])/g,<BR> =
&=
nbsp;=20
function(a,=20
b)<BR> &=
nbsp; =20
{<BR> &n=
bsp; =20
var c =3D=20
m[b];<BR> &nbs=
p; =20
if=20
(c)<BR> =
=20
{<BR> &n=
bsp; =20
return=20
c;<BR> &=
nbsp; =20
}<BR> &n=
bsp; =20
c =3D=20
b.charCodeAt();<BR> =
=20
return '\\u00' + Math.floor(c / 16).toString(16) + (c %=20
16).toString(16);<BR> &nbs=
p; =20
}<BR> &n=
bsp; <BR>  =
; =
<BR> &nb=
sp; =20
) + =
'"';<BR>  =
;=20
}<BR> <BR>&nbs=
p; =20
return '"' + this + '"';<BR> =20
};<BR> <BR> &nb=
sp; <BR> <BR>&n=
bsp; =20
})(String.prototype);<BR>}</P>
<P> </P>
<P>//=E7=94=B1=E6=95=B4=E4=B8=AAjson=E7=9A=84=E5=A4=84=E7=90=86=E8=BF=87=E6=
=88=90=E7=9C=8B=EF=BC=8C=E5=AF=B9=E8=B1=A1=E7=9A=84function=E5=B1=9E=E6=80=
=A7=E6=98=AF=E4=B8=8D=E5=A4=84=E7=90=86=E7=9A=84=E3=80=82<BR><BR>=E8=BD=AC=
=E8=87=AA=EF=BC=9A<FONT=20
face=3DVerdana>http://www.gzit.org/html/8/8-3099.html</FONT></P></FONT></=
DIV>
<DIV class=3DpostDesc>posted @ 2008-05-09 16:20 <A=20
href=3D"http://www.cnblogs.com/hehuachina/">hehuachina</A> =
=E9=98=85=E8=AF=BB(168) <A=20
href=3D"http://www.cnblogs.com/hehuachina/articles/1190165.html#Post">=E8=
=AF=84=E8=AE=BA(0)</A>=20
<A=20
href=3D"http://www.cnblogs.com/hehuachina/admin/EditArticles.aspx?postid=3D=
1190165">=E7=BC=96=E8=BE=91</A>=20
<A =
href=3D"http://www.cnblogs.com/hehuachina/AddToFavorite.aspx?id=3D1190165=
">=E6=94=B6=E8=97=8F</A>=20
<A onclick=3D"PutInWz();return false;"=20
href=3D"http://www.cnblogs.com/hehuachina/articles/1190165.html#">=E7=BD=91=
=E6=91=98</A> =E6=89=80=E5=B1=9E=E5=88=86=E7=B1=BB: <A=20
href=3D"http://www.cnblogs.com/hehuachina/category/135160.html">JSON</A> =
</DIV></DIV><IMG height=3D1=20
src=3D"http://www.cnblogs.com/hehuachina/aggbug/1190165.html?type=3D2&=
;webview=3D1"=20
width=3D1> <!--
<rdf:RDF xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc=3D"http://purl.org/dc/elements/1.1/"=0A=
xmlns:trackback=3D"http://madskills.com/public/xml/rss/module/trackback/"=
>
<rdf:Description
rdf:about=3D"http://www.cnblogs.com/hehuachina/articles/1190165.html"
dc:identifier=3D"http://www.cnblogs.com/hehuachina/articles/1190165.html"=
dc:title=3D"=E5=88=86=E6=9E=90JSON.js=EF=BC=88=E6=B3=A8=E9=87=8A=EF=BC=89=
"
trackback:ping=3D"http://www.cnblogs.com/hehuachina/services/trackbacks/1=
190165.aspx" />
</rdf:RDF>
--></DIV><!--end: topics =
=E6=96=87=E7=AB=A0=E3=80=81=E8=AF=84=E8=AE=BA=E5=AE=B9=E5=99=A8-->
<DIV id=3DAjaxHolder_UpdatePanel1>
<STYLE>TD {
FONT-SIZE: 12px
}
.commentTextBox {
FONT-SIZE: 13px; FONT-FAMILY: Verdana
}
A.blue:visited {
COLOR: blue
}
A.blue:active {
COLOR: blue
}
A.blue:link {
COLOR: blue
}
A.blue:hover {
COLOR: blue
}
</STYLE>
<!--Beging Temp Save-->
<STYLE>.userData {
BEHAVIOR: url(#default#userdata)
}
</STYLE>
<DIV class=3DuserData id=3DCommentsPersistDiv></DIV>
<SCRIPT type=3Dtext/javascript>
function pageLoad()
{
=
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(handl=
eInitializeRequest);
=
//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(handleEndR=
equest);
}
function handleInitializeRequest(sender, args)
{
var prm =3D Sys.WebForms.PageRequestManager.getInstance();
var eid =3D args.get_postBackElement().id;
/*if (eid.indexOf("DeleteLink")>0)=20
{
args.get_postBackElement().innerHTML =3D "<font =
color=3D'red'>=E6=AD=A3=E5=9C=A8=E5=88=A0=E9=99=A4...</font>"; =20
} =20
else */
if (eid.indexOf("btnSubmit")>0)=20
{
=
document.getElementById("AjaxHolder_PostComment_ltSubmitMsg").innerHTML=3D=
"=E6=AD=A3=E5=9C=A8=E6=8F=90=E4=BA=A4...";
=
document.getElementById("AjaxHolder_PostComment_btnSubmit").disabled =3D =
true; =20
} =20
else if(eid.indexOf("refreshList")>0)
{
=
document.getElementById("AjaxHolder_PostComment_refreshList").innerHTML=3D=
"<font color=3D'red'>=E6=AD=A3=E5=9C=A8=E5=88=B7=E6=96=B0...</font>";
}
=20
}=09
function TempSave(ElementID)
{
try
{
=
CommentsPersistDiv.setAttribute("CommentContent",document.getElementById(=
ElementID).value);
CommentsPersistDiv.save("CommentXMLStore");
}
catch(ex)
{
}
=09
}
function Restore(ElementID)
{
CommentsPersistDiv.load("CommentXMLStore");
=
document.getElementById(ElementID).value=3DCommentsPersistDiv.getAttribut=
e("CommentContent");
}=09
=09
=09
</SCRIPT>
<!--Ene TempSave-->
<DIV id=3DdivRefreshComments=20
style=3D"FONT-SIZE: 12px; MARGIN-BOTTOM: 5px; MARGIN-RIGHT: 10px; =
TEXT-ALIGN: right"><A=20
href=3D"http://www.cnblogs.com/RequireRegister.aspx">=E6=96=B0=E7=94=A8=E6=
=88=B7=E6=B3=A8=E5=86=8C</A> <A=20
id=3DAjaxHolder_PostComment_refreshList=20
href=3D"javascript:__doPostBack('AjaxHolder$PostComment$refreshList','')"=
>=E5=88=B7=E6=96=B0=E8=AF=84=E8=AE=BA=E5=88=97=E8=A1=A8</A> </=
DIV>
<DIV class=3Dcommentform><SPAN id=3DAjaxHolder_PostComment_ltSubmitMsg=20
style=3D"COLOR: red"></SPAN><BR><A name=3DFeedback></A>
<TABLE style=3D"WIDTH: 600px" cellSpacing=3D1 cellPadding=3D1 =
border=3D0>
<TBODY>
<TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -