⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prototype中tojson的用法.mht

📁 eclipse 中文教程 实用 word 版本
💻 MHT
📖 第 1 页 / 共 5 页
字号:
From: <由 Windows Internet Explorer 7 保存>
Subject: =?gb2312?B?t7HQx7XjteMtYmxvZw==?=
Date: Wed, 15 Oct 2008 16:18:54 +0800
MIME-Version: 1.0
Content-Type: multipart/related;
	type="text/html";
	boundary="----=_NextPart_000_0000_01C92EE1.B8388180"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C92EE1.B8388180
Content-Type: text/html;
	charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.haidianqu.com/myblog/tech/200708/2007-8-7/2007-8-7-11.html

=EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" =
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML =
xmlns=3D"http://www.w3.org/1999/xhtml"><HEAD><TITLE>=E7=B9=81=E6=98=9F=E7=
=82=B9=E7=82=B9-blog</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<META content=3D"" name=3DKeywords>
<META content=3D"" name=3DDescription><LINK=20
href=3D"http://www.haidianqu.com/myblog/style.css" type=3Dtext/css =
rel=3Dstylesheet>
<SCRIPT language=3Djavascript=20
src=3D"http://www.haidianqu.com/myblog/js/global.js"></SCRIPT>

<SCRIPT language=3Djavascript=20
src=3D"http://www.haidianqu.com/myblog/js/jquery.js"></SCRIPT>

<SCRIPT language=3Djavascript=20
src=3D"http://www.haidianqu.com/myblog/js/jquery-comments.js"></SCRIPT>

<META content=3D"MSHTML 6.00.6000.16705" name=3DGENERATOR></HEAD>
<BODY>
<DIV id=3Dtop>
<DIV id=3Dqmenu><A id=3Dskin=20
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-7/2007-8-7-11.=
html#">=E5=8D=9A=E5=AE=A2=E6=A0=B7=E5=BC=8F</A>=20
| <A =
href=3D"http://www.haidianqu.com/myblog/article/about.html">=E5=85=B3=E4=BA=
=8E=E4=BD=9C=E8=80=85</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/article/links.html">=E8=81=94=E7=B3=
=BB=E4=BD=9C=E8=80=85</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/guestbook/">=E5=9C=A8=E7=BA=BF=E7=
=95=99=E8=A8=80</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/article/tags.html">=E7=BD=91=E7=AB=
=99=E6=A0=87=E7=AD=BE</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/article/bugs.html">=E5=8D=9A=E5=AE=
=A2bugs</A> </DIV></DIV>
<DIV id=3Dbanner>
<DIV id=3Dbannerad></DIV></DIV>
<DIV id=3Dmenu>
<DIV id=3Dnv><A =
href=3D"http://www.haidianqu.com/myblog/index.html">=E9=A6=96=E9=A1=B5</A=
> | <A=20
href=3D"http://www.haidianqu.com/myblog/live">=E7=94=9F=E6=B4=BB=E9=9A=8F=
=E7=AC=94</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/work">=E5=B7=A5=E4=BD=9C=E5=B0=8F=
=E8=AE=B0</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/tech">=E6=8A=80=E6=9C=AF=E6=96=87=
=E6=91=98</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/web">=E7=BD=91=E9=A1=B5=E7=9B=B8=E5=
=85=B3</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/article/blogpic.html">=E7=A7=81=E4=
=BA=BA=E7=9B=B8=E5=86=8C</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/diary">=E6=88=90=E9=95=BF=E6=97=A5=
=E8=AE=B0</A> | <A=20
href=3D"http://www.haidianqu.com/myblog/article/about.html">=E5=85=B3=E4=BA=
=8E=E6=9C=AC=E4=BA=BA</A> </DIV></DIV>
<DIV id=3Dtips>
<DIV =
id=3Dtipsmsg>=E7=94=9F=E6=B4=BB=E5=B0=B1=E5=83=8F=E4=B8=80=E9=81=93=E8=8F=
=9C=E8=B0=B1=EF=BC=8C=E9=85=B8=EF=BC=8C=E7=94=9C=EF=BC=8C=E8=8B=A6=EF=BC=8C=
=E8=BE=A3=EF=BC=8C=E5=B0=BD=E4=BA=AB=E5=85=B6=E4=B8=AD=E3=80=82</DIV></DI=
V>
<DIV id=3Dcontent>
<DIV id=3Dtxtleft>
<DIV class=3Dtxtnv>=E6=88=91=E5=9C=A8=E8=BF=99=E9=87=8C: =
=E9=A6=96=E9=A1=B5 &gt;&gt; =E6=8A=80=E6=9C=AF=E6=96=87=E6=91=98 =
&gt;&gt; =E6=B5=8F=E8=A7=88=E6=96=87=E7=AB=A0: prototype =
JSON=E7=94=A8=E6=B3=95</DIV>
<DIV width=3D"728">
<SCRIPT type=3Dtext/javascript>
//<!--
google_ad_client =3D "pub-1383888537586416";
//728x90, =E5=88=9B=E5=BB=BA=E4=BA=8E 08-1-1
google_ad_slot =3D "4082373580";
google_ad_width =3D 728;
google_ad_height =3D 90;
//--></SCRIPT>

<SCRIPT src=3D"http://pagead2.googlesyndication.com/pagead/show_ads.js"=20
type=3Dtext/javascript>
</SCRIPT>
</DIV>
<DIV class=3Dbartitle><A class=3Dbarleft=20
href=3D"http://www.haidianqu.com/myblog/work/200708/2007-8-8/2007-8-8-12.=
html">&lt;&lt;=20
javascript=E5=8A=A8=E6=80=81=E5=8F=98=E9=87=8F</A><A class=3Dbarright=20
href=3D"http://www.haidianqu.com/myblog/work/200708/2007-8-7/2007-8-7-10.=
html">javascript=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=BD=AC=E6=8D=A2=E4=B8=BA=E6=
=95=B0=E5=AD=97=20
&gt;&gt; </A></DIV>
<H2 class=3Dtxttitle>prototype JSON=E7=94=A8=E6=B3=95</H2>
<DIV class=3Dtxtdest>2007-8-7</DIV>
<DIV class=3Dtxtbody>var data =3D {name: 'Violet', occupation: =
'character', age: 25=20
};<BR>Object.toJSON(data);<BR>//-&gt; '{"name": "Violet", "occupation":=20
"character", "age": 25}'<BR><BR><BR>=E9=87=8D=E8=BD=BDJSON<BR><BR>var =
Person =3D=20
Class.create();<BR>Person.prototype =3D {<BR>&nbsp; initialize: =
function(name,=20
age) {<BR>&nbsp;&nbsp;&nbsp; this.name =3D name;<BR>&nbsp;&nbsp;&nbsp; =
this.age =3D=20
age;<BR>&nbsp; },&nbsp; <BR>&nbsp; toJSON: function() =
{<BR>&nbsp;&nbsp;&nbsp;=20
return ('My name is ' + this.name + <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' =
and I=20
am ' + this.age + ' years old.').toJSON();<BR>&nbsp; }<BR>};<BR>var john =
=3D new=20
Person('John', 49);<BR>Object.toJSON(john);<BR>//-&gt; '"My name is John =
and I=20
am 49 years =
old."'<BR><BR>=E8=BF=99=E4=B8=AA=E6=98=AF=E8=BE=93=E5=85=A5=E6=A1=86=E4=B8=
=AD=E4=BD=BF=E7=94=A8JSON<BR><PRE><CODE class=3Dhtml>&lt;<SPAN =
class=3Dtag>input </SPAN><SPAN class=3Dattribute>id</SPAN>=3D<SPAN =
class=3Dstring>"firstname"</SPAN> <SPAN =
class=3Dattribute>name</SPAN>=3D<SPAN class=3Dstring>"firstname"</SPAN> =
<SPAN class=3Dattribute>value</SPAN>=3D<SPAN =
class=3Dstring>"john"</SPAN> /&gt;</CODE></PRE><PRE><CODE =
class=3Djavascript>Element.addMethods<SPAN =
class=3Dbrackets>(</SPAN><SPAN class=3Dstring>'input'</SPAN>, {<BR>  =
toJSON: <SPAN class=3Dkeywords>function</SPAN><SPAN =
class=3Dbrackets>(</SPAN><SPAN class=3Dglobal>element</SPAN><SPAN =
class=3Dbrackets>)</SPAN> {<BR>    <SPAN class=3Dglobal>element</SPAN> =
=3D $<SPAN class=3Dbrackets>(</SPAN><SPAN =
class=3Dglobal>element</SPAN><SPAN class=3Dbrackets>)</SPAN>;<BR>    =
<SPAN class=3Dkeywords>return</SPAN> <SPAN =
class=3Dglobal>element</SPAN>.name.toJSON<SPAN =
class=3Dbrackets>(</SPAN><SPAN class=3Dbrackets>)</SPAN> + <SPAN =
class=3Dstring>": "</SPAN> + <SPAN =
class=3Dglobal>element</SPAN>.getValue<SPAN =
class=3Dbrackets>(</SPAN><SPAN class=3Dbrackets>)</SPAN>.toJSON<SPAN =
class=3Dbrackets>(</SPAN><SPAN class=3Dbrackets>)</SPAN>;<BR>  =
}<BR>}<SPAN class=3Dbrackets>)</SPAN><BR><BR>Object.toJSON<SPAN =
class=3Dbrackets>(</SPAN>$<SPAN class=3Dbrackets>(</SPAN><SPAN =
class=3Dstring>'firstname'</SPAN><SPAN class=3Dbrackets>)</SPAN><SPAN =
class=3Dbrackets>)</SPAN>;<BR><SPAN class=3Dcomment>//-&gt; =
'"firstname": "john"'</SPAN></CODE></PRE></DIV>
<H5 class=3Dtxttags>Tags: </H5>
<DIV class=3Dtxtfloor>=E5=8F=91=E5=B8=83:| =
=E5=88=86=E7=B1=BB:=E6=8A=80=E6=9C=AF=E6=96=87=E6=91=98| =
=E8=AF=84=E8=AE=BA: | =E5=BC=95=E7=94=A8: | =E6=B5=8F=E8=A7=88:<SPAN =
id=3Dspan>1</SPAN></DIV>
<UL class=3Dtxtatt>
  <LI class=3Dtxtlink>=E7=9B=B8=E5=85=B3=E7=9A=84=E6=96=87=E7=AB=A0=20
  <LI class=3Dtxtlinkli>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-1/2007-8-1-3.h=
tml">[=E8=BD=AC]=E4=BD=BF=E7=94=A8JavaScript=E4=BA=8B=E4=BB=B6=E7=BB=BC=E5=
=90=88=E6=9F=A5=E8=AF=A2</A>??(2007-8-1)</P>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-23/2007-8-23-2=
0.html">=E8=99=9A=E6=8B=9F=E5=8C=96=E6=B2=A1=E6=9C=89=E6=A0=87=E5=87=86=EF=
=BC=9A2007=E5=B9=B4=E7=9A=843=E8=82=A1=E6=97=A7=E5=8A=BF=E5=8A=9B=E9=8F=96=
=E6=88=98=E5=BC=80=E5=A7=8B</A>??(2007-8-23)</P>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200709/2007-9-4/2007-9-4-25.=
html">FCKeditor=20
  API=E6=8E=A5=E5=8F=A3=E5=87=BD=E6=95=B0</A>??(2007-9-4)</P>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200710/2007-10-8/2007-10-8-3=
7.html">[=E8=BD=AC]=E7=BB=99=E6=B5=AE=E8=BA=81=E5=AD=A6=E4=B9=A0photoshop=
=E4=BA=BA=E5=91=98=E7=9A=84=E5=BF=A0=E5=91=8A</A>??(2007-10-8)</P>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200710/2007-10-29/2007-10-29=
-45.html">=E5=90=84=E7=A7=8D=E7=BD=91=E9=A1=B5=E5=AA=92=E4=BD=93=E6=92=AD=
=E6=94=BE=E5=99=A8=E4=BB=A3=E7=A0=81=E5=8F=8A=E8=AF=A6=E8=A7=A3</A>??(200=
7-10-29)</P>
  <P><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200711/2007-11-8/2007-11-8-4=
9.html">=E4=B8=8B=E4=B8=80=E4=BB=A3Web2.0=E5=BC=80=E5=8F=91=E7=9A=84=E8=B6=
=8B=E5=8A=BF</A>??(2007-11-8)</P></LI></UL>
<OL class=3Dcommentlist></OL>
<UL class=3Dtxtatt>
  <LI =
class=3Dtxtlink>=E5=AF=B9=E6=9C=AC=E6=96=87=E7=AB=A0=E8=AF=84=E8=AE=BA =
</LI></UL>
<DIV id=3Dgbook>
<DIV>
<FORM id=3Dcommentform =
action=3Dhttp://www.haidianqu.com/myblog/comments-post.php=20
method=3Dpost>
<DL>
  <DT><LABEL for=3Dauthor>=E5=90=8D=E5=AD=97 =
(=E5=BF=85=E9=A1=BB)</LABEL>=20
  <DD><INPUT class=3Dtext id=3Dauthor tabIndex=3D3 size=3D30 =
name=3Dauthor>=20
  <DT><LABEL for=3Demail>E-mail </LABEL>
  <DD><INPUT class=3Dtext id=3Demail tabIndex=3D4 size=3D30 =
name=3Demail>=20
  <DT><LABEL for=3Durl><ABBR=20
  title=3D"Uniform Resource =
Identifier">URI</ABBR>=EF=BC=88=E6=82=A8=E7=9A=84=E4=B8=BB=E9=A1=B5/blog=EF=
=BC=8C=E5=8F=AF=E4=B8=8D=E5=A1=AB=E5=86=99=EF=BC=89</LABEL>=20
  <DD><INPUT class=3Dtext id=3Durl tabIndex=3D5 size=3D30 name=3Durl>=20
  <DT><LABEL for=3Durl><ABBR title=3D"Uniform Resource =
Identifier">=E8=AE=A4=E8=AF=81=E7=A0=81</LABEL>=20
  <DD><INPUT class=3Dtext id=3Dchecknum tabIndex=3D5 size=3D4 =
name=3Dchecknum> <IMG=20
  src=3D"http://www.haidianqu.com/myblog/webadmin/check.php"> </DD></DL>
<P><TEXTAREA class=3Dtext id=3Dcomment tabIndex=3D6 name=3Dcomment =
rows=3D10 cols=3D70></TEXTAREA>=20
</P>
<P><INPUT class=3Dbutton id=3Dsubmit tabIndex=3D7 type=3Dsubmit =
value=3D=E6=8F=90=E4=BA=A4=E7=95=99=E8=A8=80 name=3Dsubmit>=20
<INPUT id=3Daction type=3Dhidden value=3D1 name=3Daction> <INPUT =
id=3Darticleid=20
type=3Dhidden value=3D11 name=3Darticleid> </P></FORM></DIV></DIV></DIV>
<DIV id=3Dside>
<DIV class=3Dsideblock id=3DdivCalendar>
<H3>=E6=97=A5=E5=8E=86</H3>
<DIV id=3DblogCalender>
<P class=3Dy><A onclick=3D"return getMonth(2008,8)"=20
href=3D"http://www.haidianqu.com/myblog/calendar/2008_8.html">&lt;&lt; =
</A><A=20
href=3D"http://www.haidianqu.com/myblog/calendar/2008-9.html">2008-9</A> =
<A=20
onclick=3D" return getMonth(2008,10)"=20
href=3D"http://www.haidianqu.com/myblog/calendar/2008_10.html">&gt;&gt;</=
A></P>
<P class=3Dw>Sun</P>
<P class=3Dw>Mon</P>
<P class=3Dw>Tue</P>
<P class=3Dw>Wed</P>
<P class=3Dw>Thu</P>
<P class=3Dw>Fri</P>
<P class=3Dw>Sat</P>
<P class=3Dnd></P>
<P class=3Dd>1</P>
<P class=3Dd>2</P>
<P class=3Dd>3</P>
<P class=3Dd>4</P>
<P class=3Dd>5</P>
<P class=3Dd>6</P>
<P class=3Dd>7</P>
<P class=3Dd>8</P>
<P class=3Dyd><A=20
href=3D"http://www.haidianqu.com/myblog/live/200809/2008-9-9/2008-9-9-94.=
html">9</A></P>
<P class=3Dd>10</P>
<P class=3Dd>11</P>
<P class=3Dd>12</P>
<P class=3Dd>13</P>
<P class=3Dd>14</P>
<P class=3Dd>15</P>
<P class=3Dd>16</P>
<P class=3Dyd><A=20
href=3D"http://www.haidianqu.com/myblog/work/200809/2008-9-17/2008-9-17-9=
5.html">17</A></P>
<P class=3Dd>18</P>
<P class=3Dd>19</P>
<P class=3Dd>20</P>
<P class=3Dd>21</P>
<P class=3Dd>22</P>
<P class=3Dd>23</P>
<P class=3Dd>24</P>
<P class=3Dd>25</P>
<P class=3Dd>26</P>
<P class=3Dd>27</P>
<P class=3Dd>28</P>
<P class=3Dd>29</P>
<P class=3Dyd><A=20
href=3D"http://www.haidianqu.com/myblog/web/200809/2008-9-30/2008-9-30-96=
.html">30</A></P>
<P class=3Dnd></P>
<P class=3Dnd></P>
<P class=3Dnd></P>
<P class=3Dnd></P></DIV></DIV>
<DIV class=3Dsideblock id=3Dctrlpanel>
<H3>=E6=8E=A7=E5=88=B6=E9=9D=A2=E6=9D=BF</H3>
<P class=3Dadmin><A=20
href=3D"http://www.haidianqu.com/myblog/webadmin">[=E7=AE=A1=E7=90=86=E7=99=
=BB=E5=BD=95]</A></P></DIV>
<DIV class=3Dsideblock id=3Dctrlpanel>
<H3>=E7=BD=91=E7=AB=99=E7=9B=AE=E5=BD=95</H3>
<UL>
  <LI><SPAN class=3Dfeed-icon><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-7/2007-8-7-11.=
html#"=20
  target=3D_blank><IMG title=3Drss height=3D12 alt=3Drss=20
  src=3D"http://www.haidianqu.com/myblog/images/rss.png" width=3D20=20
  border=3D0></A></SPAN> <A =
href=3D"http://www.haidianqu.com/myblog/live">=E7=94=9F=E6=B4=BB=E9=9A=8F=
=E7=AC=94<SPAN=20
  class=3Darticle-nums> (35)</SPAN></A> </LI>
  <LI><SPAN class=3Dfeed-icon><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-7/2007-8-7-11.=
html#"=20
  target=3D_blank><IMG title=3Drss height=3D12 alt=3Drss=20
  src=3D"http://www.haidianqu.com/myblog/images/rss.png" width=3D20=20
  border=3D0></A></SPAN> <A =
href=3D"http://www.haidianqu.com/myblog/work">=E5=B7=A5=E4=BD=9C=E5=B0=8F=
=E8=AE=B0<SPAN=20
  class=3Darticle-nums> (35)</SPAN></A> </LI>
  <LI><SPAN class=3Dfeed-icon><A=20
  =
href=3D"http://www.haidianqu.com/myblog/tech/200708/2007-8-7/2007-8-7-11.=
html#"=20
  target=3D_blank><IMG title=3Drss height=3D12 alt=3Drss=20
  src=3D"http://www.haidianqu.com/myblog/images/rss.png" width=3D20=20
  border=3D0></A></SPAN> <A =
href=3D"http://www.haidianqu.com/myblog/tech">=E6=8A=80=E6=9C=AF=E6=96=87=
=E6=91=98<SPAN=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -