<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>wangsong76</title>
    <description>用过了DOJO，才能体会到Jquery的好</description>
    <link>http://wangsong76.javaeye.com</link>
    <language>UTF-8</language>
    <copyright>Copyright 2003-2008, JavaEye.com</copyright>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <generator>JavaEye - 做最棒的软件开发交流社区</generator>
      <item>
        <title>HTML中小meta的大作用</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/209538" style="color:red;">http://wangsong76.javaeye.com/blog/209538</a>&nbsp;
          发表时间: 2008年06月29日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          meta是用来在HTML文档中模拟HTTP协议的响应头报文。meta 标签用于网页的&lt;head>与&lt;/head>中，meta 标签的用处很多。meta 的属性有两种：name和http-equiv。name属性主要用于描述网页，对应于content（网页内容），以便于搜索引擎机器人查找、分类（目前几乎所有的搜索引擎都使用网上机器人自动查找meta值来给网页分类）。这其中最重要的是description（站点在搜索引擎上的描述）和keywords（分类关键词），所以应该给每页加一个meta值。比较常用的有以下几个： <br /><br />name 属性 <br /><br />　　1、&lt;meta name="Generator" contect="">用以说明生成工具（如Microsoft FrontPage 4.0）等； <br /><br />　　2、&lt;meta name="KEYWords" contect="">向搜索引擎说明你的网页的关键词； <br /><br />　　3、&lt;meta name="DEscription" contect="">告诉搜索引擎你的站点的主要内容； <br /><br />　　4、&lt;meta name="Author" contect="你的姓名">告诉搜索引擎你的站点的制作的作者； <br /><br />　　5、&lt;meta name="Robots" contect= "all|none|index|noindex|follow|nofollow"> <br /><br />　　其中的属性说明如下： <br /><br />　　设定为all：文件将被检索，且页面上的链接可以被查询； <br /><br />　　设定为none：文件将不被检索，且页面上的链接不可以被查询； <br /><br />　　设定为index：文件将被检索； <br /><br />　　设定为follow：页面上的链接可以被查询； <br /><br />　　设定为noindex：文件将不被检索，但页面上的链接可以被查询； <br /><br />　　设定为nofollow：文件将不被检索，页面上的链接可以被查询。 <br /><br />　　http-equiv属性 <br /><br />　　1、&lt;meta http-equiv="Content-Type" contect="text/html";charset=gb_2312-80"> <br /><br />和 &lt;meta http-equiv="Content-Language" contect="zh-CN">用以说明主页制作所使用的文字以及语言； <br /><br />　　又如英文是ISO-8859-1字符集，还有BIG5、utf-8、shift-Jis、Euc、Koi8-2等字符集； <br /><br />　　2、&lt;meta http-equiv="Refresh" contect="n;url=http://yourlink">定时让网页在指定的时间n内，跳转到页面http://yourlink； <br /><br />　　3、&lt;meta http-equiv="Expires" contect="Mon,12 May 2001 00:20:00 GMT">可以用于设定网页的到期时间，一旦过期则必须到服务器上重新调用。需要注意的是必须使用GMT时间格式； <br /><br />　　4、&lt;meta http-equiv="Pragma" contect="no-cache">是用于设定禁止浏览器从本地机的缓存中调阅页面内容，设定后一旦离开网页就无法从Cache中再调出； <br /><br />　　5、&lt;meta http-equiv="set-cookie" contect="Mon,12 May 2001 00:20:00 GMT">cookie设定，如果网页过期，存盘的cookie将被删除。需要注意的也是必须使用GMT时间格式； <br /><br />　　6、&lt;meta http-equiv="Pics-label" contect="">网页等级评定，在IE的internet选项中有一项内容设置，可以防止浏览一些受限制的网站，而网站的限制级别就是通过meta属性来设置的； <br /><br />　　7、&lt;meta http-equiv="windows-Target" contect="_top">强制页面在当前窗口中以独立页面显示，可以防止自己的网页被别人当作一个frame页调用； <br /><br />　　8、&lt;meta http-equiv="Page-Enter" contect="revealTrans(duration=10,transtion= 50)">和&lt;meta http-equiv="Page-Exit" contect="revealTrans(duration=20，transtion=6)">设定进入和离开页面时的特殊效果，这个功能即FrontPage中的“格式/网页过渡”，不过所加的页面不能够是一个frame页面。 <br /><br />　　以上是常用的几个meta属性，有个人主页的朋友不妨在你的主页中加上它，效果可是不一样的哦：）。
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/209538#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 29 Jun 2008 22:12:15 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/209538</link>
        <guid>http://wangsong76.javaeye.com/blog/209538</guid>
      </item>
      <item>
        <title>Meta标签详解 </title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/209532" style="color:red;">http://wangsong76.javaeye.com/blog/209532</a>&nbsp;
          发表时间: 2008年06月29日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          引言 <br /><br />　　您的个人网站即使做得再精彩，在“浩瀚如海”的网络空间中，也如一叶扁舟不易为人发现，如何推广<br />个人网站，人们首先想到的方法无外乎以下几种：<br />　　<br />　　●　在搜索引擎中登录自己的个人网站<br />　　<br />　　●　在知名网站加入你个人网站的链接 <br /><br /><br />　　●　在论坛中发帖子宣传你的个人网站 <br /><br /><br />　　很多人却忽视了HTML标签META的强大功效，一个好的META标签设计可以大大提高你的个人网站被搜索到的可能性，有兴趣吗，谁我来重新认识一下META标签吧！ <br /><br /><br />　　META标签是HTML语言HEAD区的一个辅助性标签，它位于HTML文档头部的&lt;HEAD>标记和&lt;TITLE>标记之间，它提供用户不可见的信息。meta标签通常用来为搜索引擎robots定义页面主题，或者是定义用户浏览器上的cookie；它可以用于鉴别作者，设定页面格式，标注内容提要和关键字；还可以设置页面使其可以根据你定义的时间间隔刷新自己,以及设置RASC内容等级，等等。 <br /><br /> <br /><br />　　详细介绍 <br /><br /><br />　　下面介绍一些有关 标记的例子及解释。 <br /><br /><br />　　META标签分两大部分：HTTP标题信息(HTTP-EQUIV)和页面描述信息(NAME)。 <br /><br /> <br /><br />　　★HTTP-EQUIV <br /><br /><br />　　HTTP-EQUIV类似于HTTP的头部协议，它回应给浏览器一些有用的信息，以帮助正确和精确地显示网页内容。常用的HTTP-EQUIV类型有： <br /><br /> <br /><br />　　1、Content-Type和Content-Language (显示字符集的设定) <br /><br /><br />　　说明：设定页面使用的字符集，用以说明主页制作所使用的文字已经语言，浏览器会根据此来调用相应的字符集显示page内容。 <br /><br /><br />　　用法：&lt;Meta http-equiv="Content-Type" Content="text/html; Charset=gb2312"><br />　　　　　　&lt;Meta http-equiv="Content-Language" Content="zh-CN"> <br /><br /><br />　　注意：　该META标签定义了HTML页面所使用的字符集为GB2132，就是国标汉字码。如果将其中的“charset=GB2312”替换成“BIG5”，则该页面所用的字符集就是繁体中文Big5码。当你浏览一些国外的站点时，IE浏览器会提示你要正确显示该页面需要下载xx语支持。这个功能就是通过读取HTML页面META标签的Content-Type属性而得知需要使用哪种字符集显示该页面的。如果系统里没有装相应的字符集，则IE就提示下载。其他的语言也对应不同的charset，比如日文的字符集是“iso-2022-jp ”，韩文的是“ks_c_5601”。<br />　　　　　　<br />　　Content-Type的Content还可以是：text/xml等文档类型；<br />　　Charset选项：ISO-8859-1(英文)、BIG5、UTF-8、SHIFT-Jis、Euc、Koi8-2、us-ascii, x-mac-roman, iso-8859-2, x-mac-ce, iso-2022-jp, x-sjis, x-euc-jp,euc-kr, iso-2022-kr, gb2312, gb_2312-80, x-euc-tw, x-cns11643-1,x-cns11643-2等字符集；Content-Language的Content还可以是：EN、FR等语言代码。 <br /><br /><br />　　2、Refresh (刷新) <br /><br /><br />　　　说明：让网页多长时间（秒）刷新自己，或在多长时间后让网页自动链接到其它网页。<br />　　　用法：&lt;Meta http-equiv="Refresh" Content="30"><br />　　　　　　&lt;Meta http-equiv="Refresh" Content="5; Url=http://www.xia8.net"><br />　　　注意：其中的5是指停留5秒钟后自动刷新到URL网址。 <br /><br /><br />　　3、Expires (期限) <br /><br /><br />　　　说明：指定网页在缓存中的过期时间，一旦网页过期，必须到服务器上重新调阅。<br />　　　用法：&lt;Meta http-equiv="Expires" Content="0"><br />　　　　　　&lt;Meta http-equiv="Expires" Content="Wed, 26 Feb 1997 08:21:57 GMT"><br />　　　注意：必须使用GMT的时间格式，或直接设为0(数字表示多少时间后过期)。 <br /><br /><br />　　4、Pragma (cach模式) <br /><br /><br />　　　说明：禁止浏览器从本地机的缓存中调阅页面内容。<br />　　　用法：&lt;Meta http-equiv="Pragma" Content="No-cach"><br />　　　注意：网页不保存在缓存中，每次访问都刷新页面。这样设定，访问者将无法脱机浏览。 <br /><br /><br />　　5、Set-Cookie (cookie设定) <br /><br /><br />　　说明：浏览器访问某个页面时会将它存在缓存中，下次再次访问时就可从缓存中读取，以提高速度。当你希望访问者每次都刷新你广告的图标，或每次都刷新你的计数器，就要禁用缓存了。通常HTML文件没有必要禁用缓存，对于ASP等页面，就可以使用禁用缓存，因为每次看到的页面都是在服务器动态生成的，缓存就失去意义。如果网页过期，那么存盘的cookie将被删除。<br />　　　用法：&lt;Meta http-equiv="Set-Cookie" Content="cookievalue=xxx; expires=Wednesday,<br />　　　　　　 21-Oct-98 16:14:21 GMT; path=/"><br />　　　注意：必须使用GMT的时间格式。 <br /><br /><br />　　6、Window-target (显示窗口的设定) <br /><br /><br />　　　说明：强制页面在当前窗口以独立页面显示。<br />　　　用法：&lt;Meta http-equiv="Widow-target" Content="_top"><br />　　　注意：这个属性是用来防止别人在框架里调用你的页面。Content选项：_blank、_top、_self、_parent。 <br /><br /><br />　　7、Pics-label (网页RSAC等级评定)<br />　　　说明：在IE的Internet选项中有一项内容设置，可以防止浏览一些受限制的网站，而网站的限制级<br />　　　　　　别就是通过该参数来设置的。<br />　　　用法：&lt;META http-equiv="Pics-label" Contect=<br />　　　　　　　　　　　　　　　"(PICS－1.1'http://www.rsac.org/ratingsv01.html'<br />　　　　　　 I gen comment 'RSACi North America Sever' by 'inet@microsoft.com' <br />　　　　　　　for 'http://www.microsoft.com' on '1997.06.30T14:21－0500' r(n0 s0 v0 l0))"> <br /><br /><br />　　　注意：不要将级别设置的太高。RSAC的评估系统提供了一种用来评价Web站点内容的标准。用户可以设置Microsoft Internet Explorer（IE3.0以上）来排除包含有色情和暴力内容的站点。上面这个例子中的HTML取自Microsoft的主页。代码中的（n 0 s 0 v 0 l 0）表示该站点不包含不健康内容。级别的评定是由RSAC，即美国娱乐委员会的评级机构评定的，如果你想进一步了解RSAC评估系统的等级内容，或者你需要评价自己的网站，可以访问RSAC的站点：http://www.rsac.org/。 <br /><br /><br />　　8、Page-Enter、Page-Exit (进入与退出) <br /><br /><br />　　　说明：这个是页面被载入和调出时的一些特效。<br />　　　用法：&lt;Meta http-equiv="Page-Enter" Content="blendTrans(Duration=0.5)"><br />　　　　　　&lt;Meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.5)"><br />　　　注意：blendTrans是动态滤镜的一种，产生渐隐效果。另一种动态滤镜RevealTrans也可以用于页面进入与退出效果: <br /><br /><br />　　　　　　&lt;Meta http-equiv="Page-Enter" Content="revealTrans(duration=x, transition=y)"><br />　　　　　　&lt;Meta http-equiv="Page-Exit" Content="revealTrans(duration=x, transition=y)"> <br /><br /><br />　　　　　　　Duration　　表示滤镜特效的持续时间(单位：秒)<br />　　　　　　　Transition　滤镜类型。表示使用哪种特效，取值为0-23。 <br /><br /><br />　　　　　　　0 矩形缩小<br />　　　　　　　1 矩形扩大<br />　　　　　　　2 圆形缩小<br />　　　　　　　3 圆形扩大<br />　　　　　　　4 下到上刷新<br />　　　　　　　5 上到下刷新<br />　　　　　　　6 左到右刷新<br />　　　　　　　7 右到左刷新<br />　　　　　　　8 竖百叶窗<br />　　　　　　　9 横百叶窗<br />　　　　　　 10 错位横百叶窗<br />　　　　　　 11 错位竖百叶窗<br />　　　　　　 12 点扩散<br />　　　　　　 13 左右到中间刷新<br />　　　　　　 14 中间到左右刷新<br />　　　　　　 15 中间到上下<br />　　　　　　 16 上下到中间<br />　　　　　　 17 右下到左上<br />　　　　　　 18 右上到左下<br />　　　　　　 19 左上到右下<br />　　　　　　 20 左下到右上<br />　　　　　　 21 横条<br />　　　　　　 22 竖条<br />　　　　　　 23 以上22种随机选择一种 <br /><br /><br />　　9、MSThemeCompatible (XP主题)<br />　　　说明：是否在IE中关闭 xp 的主题<br />　　　用法：&lt;Meta http-equiv="MSThemeCompatible" Content="Yes"><br />　　　注意：关闭 xp 的蓝色立体按钮系统显示样式，从而和win2k 很象。 <br /><br /><br />　　10、IE6 (页面生成器)<br />　　　说明：页面生成器generator，是ie6<br />　　　用法：&lt;Meta http-equiv="IE6" Content="Generator"><br />　　　注意：用什么东西做的，类似商品出厂厂商。 <br /><br /><br />　　11、Content-Script-Type (脚本相关)<br />　　　说明：这是近来W3C的规范，指明页面中脚本的类型。<br />　　　用法：&lt;Meta http-equiv="Content-Script-Type" Content="text/javascript"><br />　　　注意： <br /><br /><br />　　★NAME变量 <br /><br /><br />　　name是描述网页的，对应于Content（网页内容），以便于搜索引擎机器人查找、分类（目前几乎所有的搜索引擎都使用网上机器人自动查找meta值来给网页分类）。<br />　　name的value值（name=""）指定所提供信息的类型。有些值是已经定义好的。例如description(说明)、keyword(关键字)、refresh(刷新)等。还可以指定其他任意值，如：creationdate(创建日期) 、<br />document ID(文档编号)和level(等级)等。<br />　　name的content指定实际内容。如：如果指定level(等级)为value(值)，则Content可能是beginner(初级)、intermediate(中级)、advanced(高级)。 <br /><br /> <br /><br />　　1、Keywords (关键字)<br />　　　说明：为搜索引擎提供的关键字列表<br />　　　用法：&lt;Meta name="Keywords" Content="关键词1,关键词2，关键词3,关键词4,……"><br />　　　注意：各关键词间用英文逗号“,”隔开。META的通常用处是指定搜索引擎用来提高搜索质量的关键词。当数个META元素提供文档语言从属信息时，搜索引擎会使用lang特性来过滤并通过用户的语言优先参照来显示搜索结果。例如：<br />　　　　　　&lt;Meta name="Kyewords" Lang="EN" Content="vacation,greece,sunshine"><br />　　　　　　&lt;Meta name="Kyewords" Lang="FR" Content="vacances,grè:ce,soleil"> <br /><br /><br />　　2、Description (简介)<br />　　　说明：Description用来告诉搜索引擎你的网站主要内容。<br />　　　用法：&lt;Meta name="Description" Content="你网页的简述"><br />　　　注意： <br /><br /><br />　　3、Robots (机器人向导)<br />　　　说明：Robots用来告诉搜索机器人哪些页面需要索引，哪些页面不需要索引。Content的参数有all、none、index、noindex、follow、nofollow。默认是all。<br />　　　用法：&lt;Meta name="Robots" Content="All|None|Index|Noindex|Follow|Nofollow"><br />　　　注意：许多搜索引擎都通过放出robot/spider搜索来登录网站，这些robot/spider就要用到meta元素的一些特性来决定怎样登录。 <br /><br /><br />　　　 all：文件将被检索，且页面上的链接可以被查询；<br />　　　 none：文件将不被检索，且页面上的链接不可以被查询；(和 "noindex, no follow" 起相同作用)<br />　　　 index：文件将被检索；（让robot/spider登录）<br />　　　 follow：页面上的链接可以被查询；<br />　　　 noindex：文件将不被检索，但页面上的链接可以被查询；(不让robot/spider登录)<br />　　　nofollow：文件将不被检索，页面上的链接可以被查询。(不让robot/spider顺着此页的连接往下探找) <br /><br /><br />　　4、Author (作者)<br />　　　说明：标注网页的作者或制作组<br />　　　用法：&lt;Meta name="Author" Content="张三，abc@sina.com"><br />　　　注意：Content可以是：你或你的制作组的名字,或Email <br /><br /><br />　　5、Copyright (版权)<br />　　　说明：标注版权<br />　　　用法：&lt;Meta name="Copyright" Content="本页版权归Zerospace所有。All Rights Reserved"><br />　　　注意： <br /><br /><br />　　6、Generator (编辑器)<br />　　　说明：编辑器的说明<br />　　　用法：&lt;Meta name="Generator" Content="PCDATA|FrontPage|"><br />　　　注意：Content="你所用编辑器" <br /><br /><br />　　7、revisit-after (重访)<br />　　　说明：<br />　　　用法：&lt;META name="revisit-after" CONTENT="7 days" ><br />　　　注意： <br /><br /><br />　　★Head中的其它一些用法 <br /><br /> <br /><br />　　1、scheme (方案)<br />　　　说明：scheme can be used when name is used to specify how the value of content should<br />　　　　　　be interpreted.<br />　　　用法：&lt;meta scheme="ISBN" name="identifier" content="0-14-043205-1" /><br />　　　注意： <br /><br /><br />　　2、Link (链接)<br />　　　说明：链接到文件<br />　　　用法：&lt;Link href="soim.ico" rel="Shortcut Icon"><br />　　　注意：很多网站如果你把她保存在收件夹中后，会发现它连带着一个小图标，如果再次点击进入之后还会发现地址栏中也有个小图标。现在只要在你的页头加上这段话，就能轻松实现这一功能。&lt;LINK> 用来将目前文件与其它 URL 作连结，但不会有连结按钮，用於 &lt;HEAD> 标记间， 格式如下： <br />　　　　　　　&lt;link href="URL" rel="relationship"> <br />　　　　　　　&lt;link href="URL" rev="relationship"> <br /><br /><br />　　3、Base (基链接)<br />　　　说明：插入网页基链接属性<br />　　　用法：&lt;Base href="http://www.xia8.net/" target="_blank"><br />　　　注意：你网页上的所有相对路径在链接时都将在前面加上“http://www.cn8cn.com/”。其中target="_blank"是链接文件在新的窗口中打开，你可以做其他设置。将“_blank”改为“_parent”是链接文件将在当前窗口的父级窗口中打开；改为“_self”链接文件在当前窗口（帧）中打开；改为“_top”链接文件全屏显示。 <br /><br /> <br /><br />　　以上是META标签的一些基本用法，其中最重要的就是：Keywords和Description的设定。为什么呢？道理很简单，这两个语句可以让搜索引擎能准确的发现你，吸引更多的人访问你的站点!根据现在流行搜索引擎(Google，Lycos，AltaVista等)的工作原理，搜索引擎先派机器人自动在WWW上搜索，当发现新的网站时，便于检索页面中的Keywords和Description，并将其加入到自己的数据库，然后再根据关键词的密度将网站排序。 <br /><br /><br />　　由此看来，我们必须记住添加Keywords和Description的META标签，并尽可能写好关键字和简介。否则，<br />后果就会是：<br />　　<br />　　●　如果你的页面中根本没有Keywords和Description的META标签，那么机器人是无法将你的站点加入数<br />　　　　据库，网友也就不可能搜索到你的站点。 <br /><br /><br />　　●　如果你的关键字选的不好，关键字的密度不高，被排列在几十甚至几百万个站点的后面被点击的可<br />　　　　能性也是非常小的。 <br /><br /><br />　　写好Keywords(关键字)要注意以下几点： <br /><br /> <br /><br />　　●　不要用常见词汇。例如www、homepage、net、web等。 <br /><br /><br />　　●　不要用形容词，副词。例如最好的，最大的等。 <br /><br /><br />　　●　不要用笼统的词汇，要尽量精确。例如“爱立信手机”，改用“T28SC”会更好。 <br /><br /> <br /><br />　　“三人之行，必有我师”，寻找合适关键词的技巧是：到Google、Lycos、Alta等著名搜索引擎，搜索与<br />你的网站内容相仿的网站，查看排名前十位的网站的META关键字，将它们用在你的网站上，效果可想而知了。 <br /><br /><br />　　★小窍门 <br /><br /><br />　　为了提高搜索点击率，这里还有一些“捷径”可以帮得到你： <br /><br /><br />　　●　为了增加关键词的密度，将关键字隐藏在页面里(将文字颜色定义成与背景颜色一样)。 <br /><br /><br />　　●　在图像的ALT注释语句中加入关键字。如：&lt;IMG SRC="xxx.gif" Alt="Keywords"> <br /><br /><br />　　●　利用HTML的注释语句，在页面代码里加入大量关键字。用法： &lt;!-- 这里插入关键字 --> <br /><br /> <br /><br />&lt;head>　　&lt;title>文件头，显示在浏览器标题区&lt;/title>　　&lt;meta http-equiv="Content-Language" content="zh-cn">　　&lt;meta http-equiv="Content-Type" content="text/html; charset=gb2312">　　&lt;meta name="GENERATOR" content="Microsoft FrontPage 4.0">　　&lt;meta name="ProgId" content="FrontPage.Editor.Document">　　&lt;meta name="制作人" content="唐蓉生">　　&lt;meta name="主题词" content="HTML 网页制作 课件">&lt;/head>
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/209532#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 29 Jun 2008 21:59:28 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/209532</link>
        <guid>http://wangsong76.javaeye.com/blog/209532</guid>
      </item>
      <item>
        <title>最简单的方法实现去iframe滚动条</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/209530" style="color:red;">http://wangsong76.javaeye.com/blog/209530</a>&nbsp;
          发表时间: 2008年06月29日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          该文也可以说是一个iframe自适应大小的折中解决办法。<br />iframe出现滚动条的原因是，body里面的内容的高度大于了iframe的高度，所以会出现滚动条。<br /><br />解决办法：<br />采用Jquery从iframe嵌套的页面中获取一个高度值，在iframe的父窗口中的onload事件中更新iframe的高度。<br />具体实现代码：<br />父页面：<br /><pre name="code" class="html">
&lt;script type="text/javascript">
function SetCwinHeight(){
  	 var H=$("#myiframe").contents().find("meta").attr("content");
	 alert(H);
	 $("#myiframe2").height(H);
	
 }
&lt;/script>
&lt;body style="overflow:auto;">
&lt;iframe id="myiframe" src="xx.html"  onLoad="SetCwinHeight()">&lt;/iframe>
&lt;/body>
</pre><br />子页面：<br /><pre name="code" class="html">
&lt;meta content="800px">
</pre><br /><br />运行原理： 父页面读取子页面中meta的字段值来设置iframe的高度<br /><br />额外说明：<br />当iframe 的高度小于内容高度时，如果父窗口的BODY 的overflow:auto，则会出现2个垂直滚动条，iframe的垂直滚动条和父窗口的滚动条；<br />如果这时，BODY 的overflow:hidden，则只会出现iframe的垂直滚动条，但是，iframe的内容显示不完。
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/209530#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sun, 29 Jun 2008 21:49:23 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/209530</link>
        <guid>http://wangsong76.javaeye.com/blog/209530</guid>
      </item>
      <item>
        <title>Apache2.2.8+PHP5.2.6+mysql5.0+phpMyAdmin2.11.6</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/201438" style="color:red;">http://wangsong76.javaeye.com/blog/201438</a>&nbsp;
          发表时间: 2008年06月09日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Apache+PHP+MySQL+phpMyAdmin <br />    Apache2.2.8; apache_2.2.8-win32-x86-no_ssl.msi<br />          PHP5.2.6: php-5.2.6-win32-installer.msi<br />          mysql5.0: mysql-5.0.15-win32<br />  phpMyAdmin2.11.6: phpMyAdmin-2.11.6-all-languages.zip<br /><br /><br />Apache2：<br />安装为向导模式。设安装目录为D:\Program Files\Apache Software Foundation\Apache2.2<br />安装之后有2个可选操作 配置http的主目录、配置首页默认文件、虚拟目录配置<br />1.配置http的主目录：<br />编辑D:\Program Files\Apache Software Foundation\Apache2.2\conf中的Httpd.conf文件<br />更改DocumentRoot <br />DocumentRoot "D:/Program Files/Apache Software Foundation/Apache2.2/<br />为欲设置的文件目录，如D:\Inetpub<br />同时设置其后紧跟的 <br />&lt;Directory "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"> <br />更改为相同的设置，同上D:\Inetpub<br /><br />2.配置首页默认文件<br />在httpd.conf文件中更改<br />&lt;IfModule dir_module><br />    DirectoryIndex index.php index.html<br />&lt;/IfModule><br />此时APACHE接照index.php index.html的顺序本找首页文件，保存httpd.conf的修改，重启APache http server。<br />3.配置虚拟目录<br />虚拟目录并非真正的目录，实际上他是不存在的，它只是通过一种方法利用一个名字代替计算机里一个真正的目录，这个目录可在计算机上的任何位置，也可以是网络上的共享资源。<br />虚拟目录用来代替计算机中原有的复杂目录结构，简化操作，同时比实际目录更具安全性。如计算机wwwroot目录下有一个子目录F:\wwwroo\index-71se\index，这样当客户访问时必须输入<br />“http://www.71se.com/index-71se/index“，这样太繁琐了，此时便可用到Apache中的虚拟目录，比如用71se代替index-71se\index以那只要输入http://www.71se.com/71se即可到达该站点<br />要配置虚拟目录，需要打开httpd.conf找到以上内容：<br />&lt;IfModule mod_alias.c><br />……<br />&lt;/IfModule><br />在这中间添加以下内容：<br />Alias /71se/" F:/wwwroot/index-71se/index"<br />&lt;Directory "F:/wwwroot/index-71se.com/index"><br /> Options Indexes FollowSymLinks MultiViews<br /> AllowOverride None<br /> Order allow,deny<br /> Allow from all<br />&lt;/Directory><br />其中，Alias设置了虚拟目录,把F:/wwwroot/index-71se/index映射到71se,下面几行是对目录调协的属性:<br />Option:定义在目录内所能执行的操作;<br />Indexes:允许服务返回目录的格式化列表;<br />FollowSymlinks:允许页面连接到别处;<br />MultiViews:允许访问者在当前目录中查看动画或收听音乐;<br />AllowOverride None:表示只能浏览；<br />Allow from all:接受所有用户的访问。<br />保存修改结果，重起Apache.<br /><br />PHP5.2.6:<br />设安装目录为D:\Program Files\php<br />解压phpMyAdmin-2.11.6-all-languages.zip到安装目录，不要使用php-5.2.6-win32-installer.msi<br />重命名php.ini-dist为php.ini<br /><br />为了让Apache2支持PHP，需更改Apache2的Httpd.conf的配置：<br />添加：<br />LoadModule php5_module "D:/Program Files/php/php5apache2_2.dll"<br />PHPIniDir "D:/Program Files/php"<br />AddType application/x-httpd-php .php<br />AddType application/x-httpd-php .html<br /><br />重启Apache服务器。<br /><br />测试PHP是否可用：<br /><br />在D:\Inetpub下新建test.php,<br />&lt;?php<br />phpinfo();<br />?><br /><br />通过浏览http://localhost/test.php  如可正常游览则配置成功。<br /><br />为了php能加载扩展dll，在系统环境变量里面添加安装目录。点击“我的电脑”->属性->高级->环境变量->path<br />添加：D:\Program Files\PHP;D:\Program Files\PHP\ext<br />重启计算机让环境变量生效。<br /><br />为了phpMyAdmin可以正常使用，需要更改php.ini如下位置：<br />去掉<br />extension=php_mcrypt.dll<br />extension=php_mysql.dll<br />extension=php_mbstring.dll<br />前面的;<br /><br />phpMyAdmin2.11.6<br /><br />将phpMyAdmin解压缩到你想要的文件夹中，例如我这里D:\Inetpub\phpmyadmin，修改config.sample.inc.php并重命名为config.inc.php。<br />修改内容如下：<br />$cfg['blowfish_secret'] = 'wangsong'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */此处必须添，<br />/* Authentication type */<br />$cfg['Servers'][$i]['auth_type'] = 'cookie';<br />/* Server parameters */<br />$cfg['Servers'][$i]['host'] = 'localhost';<br />$cfg['Servers'][$i]['connect_type'] = 'tcp';<br />$cfg['Servers'][$i]['compress'] = false;<br />/* Select mysqli if your server has it */<br />$cfg['Servers'][$i]['extension'] = 'mysql';<br />/* User for advanced features */<br /> $cfg['Servers'][$i]['controluser'] = 'root';  // mysql登录名<br /> $cfg['Servers'][$i]['controlpass'] = 'admin'; // 登陆密码<br />在apache的httpd.conf中添加虚拟目录<br />在&lt;IfModule alias_module>&lt;/IfModule>之间添加如下内容：<br />Alias /phpmyadmin "D:/Inetpub/phpmyadmin"<br />&lt;Directory "D:/Inetpub/phpmyadmin"><br />  Options Indexes MultiViews <br />  AllowOverride None <br />  Order allow,deny<br />  Allow from all<br />&lt;/Directory>
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/201438#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 09 Jun 2008 01:14:50 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/201438</link>
        <guid>http://wangsong76.javaeye.com/blog/201438</guid>
      </item>
      <item>
        <title>在windows下配置 Apache Http 部分属性</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/201188" style="color:red;">http://wangsong76.javaeye.com/blog/201188</a>&nbsp;
          发表时间: 2008年06月07日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          <u><strong>配置主目录：</strong></u><br />当用户访问一个网站时，输入域名然后直接进入的目录即为主目录，他至少包含默认的首页文件，一般网站的文件均放在些目录下面，当然这也有例外的。<br />假设apache_2.2.8安装目录为：<div class="quote_title">引用</div><div class="quote_div">D:\Program Files\Apache Software Foundation\Apache2.2\</div><br />用记事本打开<div class="quote_title">引用</div><div class="quote_div">D:\Program Files\Apache Software Foundation\Apache2.2\conf</div>下面的Httpd.conf文件，用搜索功能找到<div class="quote_title">引用</div><div class="quote_div">DocumentRoot "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"</div>,<br />把<div class="quote_title">引用</div><div class="quote_div">D:/Program Files/Apache Software Foundation/Apache2.2/htdocs</div>改为你存放网站的的目录，比如:"D:\wwwroot"。<br /><span style="color: red">还需修改 </span><div class="quote_title">引用</div><div class="quote_div">&lt;Directory "D:/Program Files/Apache Software Foundation/Apache2.2/htdocs"><br /></div><br />为:"D:\wwwroot"<br />修改完后，将文件保存起来，然后单击“开始—程序—Apache http server--control http server-->restart",重新启动Apache http server<br />*注意：apache在修改配置文件时，目录结构不像WINDOWS使用"\",而是使用"/"。
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/201188#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Sat, 07 Jun 2008 17:13:53 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/201188</link>
        <guid>http://wangsong76.javaeye.com/blog/201188</guid>
      </item>
      <item>
        <title>互联网黑色产业链</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/195958" style="color:red;">http://wangsong76.javaeye.com/blog/195958</a>&nbsp;
          发表时间: 2008年05月23日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          据业内的一份报告显示，我国已经形成了以“制造病毒——传播病毒——盗窃账户信息——第三方平台销赃——洗钱”为环节的一条完整产业链，一个个黑客和病毒传播者利用这条产业链，非法获取巨大的经济利益。 <br /><br />　　在这条产业链上，每个环节都有不同的牟利方式。以“灰鸽子”为例，木马的制造者作为第一个环节，仅仅是提供“作案”工具，一般本身不参与到“赚钱”的环节，只是通过卖出“工具”来获利。而传播病毒环节则在购买到病毒之后，再提高价格，一级一级卖给下层的病毒购买者，非常类似于普通产品的经销商模式。木马病毒经过层层传递之后，达到病毒操作者的手里，也就是行话中的“大侠”，“大侠”在自己进行盗窃、破坏网络的同时召集“徒弟”，教授木马病毒控制技术和网络盗窃技术，并收取一定的“培训费”，同时将“徒弟”发展为下线，专职盗号或窃取他人信息。被木马侵入的电脑则被形象的称为“肉鸡”，“肉鸡”的个人信息、账号、游戏装备、私人照片、私人视频、QQ号码等被专职盗号的黑客盗取后在网上的正规交易网站正常交易。除了倒卖“肉鸡”中的数据外，黑客们还可能将自己没有兴趣的“肉鸡”倒卖给其他的黑客继续摧残，或者将“肉鸡”倒卖给广告商，被控制电脑被随意投放广告，甚至干脆控制电脑点击某网站广告，一举一动都能被监视和控制。如此严密的黑色经济产业链条令人触目惊心。
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/195958#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Fri, 23 May 2008 11:38:32 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/195958</link>
        <guid>http://wangsong76.javaeye.com/blog/195958</guid>
      </item>
      <item>
        <title>JSON in JavaScript（翻译）</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/190676" style="color:red;">http://wangsong76.javaeye.com/blog/190676</a>&nbsp;
          发表时间: 2008年05月07日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          JavaScript is a general purpose programming language that was introduced as the page scripting language for Netscape Navigator. It is widely believed to be a subset of Java, but it is not. It is a Scheme-like language with C-like syntax and soft objects. JavaScript was standardized in the ECMAScript Language Specification, Third Edition.<br /><br />JSON is a subset of the object literal notation of JavaScript. Since JSON is a subset of JavaScript, it can be used in the language with no muss or fuss.<br /><br />var myJSONObject = {"bindings": [<br />        {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"},<br />        {"ircEvent": "PRIVMSG", "method": "deleteURI", "regex": "^delete.*"},<br />        {"ircEvent": "PRIVMSG", "method": "randomURI", "regex": "^random.*"}<br />    ]<br />};<br /><div class="quote_title">引用</div><div class="quote_div"><br />In this example, an object is created containing a single member "bindings", which contains an array containing three objects, each containing "ircEvent", "method", and "regex" members.<br />Members can be retrieved using dot or subscript operators.<br /></div><br />在这个例子中，一个对象被创建，它有一个"bindings"成员，"bindings"包含了一个数组，这个数组有3个对象，每个对象包含"ircEvent", "method","regex"这3个成员。<br />成员能通过点，或者下标访问。<br /><br />myJSONObject.bindings[0].method    // "newURI"<br /><div class="quote_title">引用</div><div class="quote_div"><br />To convert a JSON text into an object, use the eval() function. eval() invokes the JavaScript compiler. Since JSON is a proper subset of JavaScript, the compiler will correctly parse the text and produce an object structure.<br /></div><br />转换一个JSON文本为对象，通常使用eval() 函数。eval() 运行在<br />JavaScript 编译器上。由于JSON是JavaScript的专属子集，编译器将会正确的解析文本，并且构造一个对象。<br /><br />var myObject = eval('(' + myJSONtext + ')');<br /><div class="quote_title">引用</div><div class="quote_div"><br />The eval function is very fast. However, it can compile and execute any JavaScript program, so there can be security issues. The use of eval is indicated when the source is trusted and competent. This is commonly the case in web applications when a web server is providing both the base page and the JSON data. There are cases where the source is not trusted. In particular, clients should never be trusted.<br /></div><br />eval 函数运行非常快。但是，因为他能编译和执行任何JavaScript 程序，所以就存在一些安全问题。如果JavaScript 代码是安全可靠的则可以使用eval 函数。通常情况下WEB应用服务器上运行的程序是既提供基本页面也提供JSON数据。很多情况下这种代码是不可靠的。在某些情况下，客服端是根本不可靠的。<br /><br /><div class="quote_title">引用</div><div class="quote_div"><br />When security is a concern it is better to use a JSON parser. A JSON parser will recognize only JSON text and so is much safer:<br /></div><br />当安全性成为使用JSON 解析的一个障碍时，只解析JSON 文本则安全的多：<br /><br />var myObject = JSON.parse(myJSONtext, filter);<br /><br /><div class="quote_title">引用</div><div class="quote_div"><br />The optional filter parameter is a function that will be called for every key and value at every level of the final result. Each value will be replaced by the result of the filter function. This can be used to reform generic objects into instances of classes, or to transform date strings into Date objects.<br /></div><br />可选参数“filter”是一个函数，它会作用于最后结果里面的每一层上的键和值。每一个值将会被filter 函数过滤后重构。这一特性能把普通对象转换为类的实例，或者把日期字符串转化为日期对象。<br />    myData = JSON.parse(text, function (key, value) {        return key.indexOf('date') >= 0 ? new Date(value) : value;    });<br /><div class="quote_title">引用</div><div class="quote_div"><br />A JSON stringifier goes in the opposite direction, converting JavaScript data structures into JSON text. JSON does not support cyclic data structures, so be careful to not give cyclical structures to the JSON stringifier.<br /></div><br />stringifier ：将对象转换为字符文本。<br />JSON stringifier是反向的将一个JavaScript结果转化为JSON文本。JSON不支持循环数据结构，因此小心不要把一个循环结构用JSON stringifier处理。<br />var myJSONText = JSON.stringify(myObject);<br /><div class="quote_title">引用</div><div class="quote_div"><br />If the stringify method sees an object that contains a toJSON method, it calls the method, and stringifies the value returned. This allows an object to determine its own JSON representation.<br /></div><br />如果一个stringifier方法发现一个对象包含有toJSON 方法，它将会调用toJSON 方法，返回字符串化后的值。这就是允许一个对象中断它自己的JSON表述。 <br /><br /><div class="quote_title">引用</div><div class="quote_div"><br />The stringifier method can take an optional array of strings. These strings are used to select the properties that will be included in the JSON text. Otherwise, all of the properties of the object will be included. In any case, values that do not have a representation in JSON (such as functions and undefined) are excluded.<br /></div><br />stringifier 方法能带一个字符串数组做参数。这些字符串参数被用来筛选将被包含在JSON 文本中的对象的属性。否则，对象所有的属性都将包含在JSON 文本中。在任何情况下，不包含JSON 表达式的值（例如functions、undefined）是被排除的。<br /><br />The open source code of a JSON parser and JSON stringifier is available. When minified it is less than 2K.
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/190676#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 07 May 2008 17:33:43 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/190676</link>
        <guid>http://wangsong76.javaeye.com/blog/190676</guid>
      </item>
      <item>
        <title>（原）DOJO之dojo.query、JSON树（结构）、dojo读取json</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/190432" style="color:red;">http://wangsong76.javaeye.com/blog/190432</a>&nbsp;
          发表时间: 2008年05月07日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          老外这么说：<br />dojo.query() is the swiss army knife of DOM node manipulation in Dojo. Much like Prototype’s “$$” (bling-bling) function or JQuery’s “$” function, dojo.query provides robust, high-performance CSS-based node selector support with the option of scoping searches to a particular sub-tree of a document<br />简单点说，就是dojo.query()是可以按样式、标签名、字符等等，来查询文档中的某个元素。<br />关键是怎么使用，国外的网上说的很清楚，其实你要是能耐住性子把DOJO BOOK里面的都认认真真看一边，就不用看我下面写的这点东西。<br />我也是惊叹dojo.query 中文资料的匮乏，才把自己看的英文资料和自己的实践做个小结，利人利己。<br />这个是老外的例子：<br />Example 1<br />search the entire document for elements with the class “foo”:<br /><br />dojo.query(".foo");<br /><br />these elements will match:<br /><br />Example 2<br />search the entire document for elements with the classes “foo” and “bar”:<br /><br />dojo.query(".foo.bar");<br />these elements will match:<br /><br />while these will not:<br /><br />Example 3<br />find “ elements which are descendants of paragraphs and which have a “highlighted” class:<br /><br />dojo.query("p span.highlighted");<br />the innermost span in this fragment matches:<br /><br />...<br />        ...<br />Example 4<br />set an “odd” class on all odd table rows inside of the table<br /><br />#tabular_data<br />, using the<br />&amp;gt;<br />(direct child) selector to avoid affecting any nested tables:<br />dojo.query("#tabular_data &amp;gt; tbody &amp;gt; tr:nth-child(odd)").addClass("odd");<br />Example 5<br />remove all elements with the class “error” from the document and store them in a list:<br /><br />var errors = dojo.query(".error").orphan();<br />Example 6<br />add an onclick handler to every submit button in the document which causes the form to be sent via Ajax instead:<br /><br />dojo.query("input[type='submit']").onclick(function(e){<br />    dojo.stopEvent(e); // prevent sending the form<br />    var btn = e.target;<br />    dojo.xhrPost({<br />        form: btn.form,<br />        load: function(data){<br />            // replace the form with the response<br />            var div = dojo.doc.createElement("div");<br />            dojo.place(div, btn.form, "after");<br />            div.innerHTML = data;<br />            dojo.style(btn.form, "display", "none");<br />        }<br />    });<br />});<br /><br />上面这些例子主要是为了大家能了解query，怎么用！<br />下面是我自己的例子：<br />结合JSON查询。<br />这个是个JSON集合，比较好的用法是你把这个代码放在一个filename.json的文件里。<br />我放在D:\WK50\tems114\test.json<br /><pre name="code" class="js">
{ identifier: 'name',
     label: 'name',
     items: [
       { name:'Africa', type:'continent',
           children:[{_reference:'Egypt'}, {_reference:'Sudan'}] },
       { name:'Egypt', type:'country' },
       { name:'Kenya', type:'country' },
       { name:'Sudan', type:'country' }
  ]}
</pre><br /> 对于这个JSON的结构有几句话：<br />JSON的结构，就是 键：值<br />identifier中文意思：标识符；identifier: 'name' 的意思就是指定后面items里面的name键为标识符。老外说标识符就是唯一识别元组，不会重复的那个东西。<br />label 中文意思：标签；我的理解就是一个说明吧，这个就好像是你有名字，又有身份证编号一样。这个label就是你的名字，那个identifier就是你的身份证编号。<br />items 中文意思：元素集合 ，就表示是一个数组，jsonAarry<br />上面说这些，是为了说明下面这个：<br />如果你要获取一个元素的label 需要用store.getLabel(item)  这下问题来了：<br />store是什么？item是什么？先解释一下store就是数据源，dojo里面有个方法可以把json读取后存储为一个数据源，这里的item和上面说的items是有关系的，item就是items中的元素，具体的要看下面的代码。这个也是老外的例子，指不过我略微修改和加了点注释。如果要运行改代码，有个必要条件就是你在引入dojo.js的时候，djConfig里面的isDebug: true  我是jsp的页面，里面引用如下：<br /><pre name="code" class="js">
 &lt;script type="text/javascript" 
    src="&lt;html:rewrite page='/dojoroot/dojo/dojo.js'/>"  
    djConfig="parseOnLoad: true, isDebug: true,usePlainJson:true ">&lt;/script>		
</pre><br />这个例子看似复杂，明白了每句话的意思之后，才觉得，真是简单啊！<br /><pre name="code" class="js">
function test()
{//读取json
var store = new dojo.data.ItemFileReadStore({url: "&lt;html:rewrite page="/test.json"/>"});
//下面这个是函数申明，其实就是function gotContinents (items, request);
//这个函数是为了处理后面query: {type: "continent"}返回的结果。具体看
//store.fetch({query: {type: "continent"}, onComplete: gotContinents});  的注解。
// items 是一个数组，查询返回的结果集，request就是请求。至于这个request怎么
//用，我也不清楚，看了很多也没发现这个东西有什么用！
//里面的console.log 其实就是 console.debug() 就是向dojo调试控制台输出。很多
///用alert()返回是object的东西，通过这2个函数，可以输出具体值，比如本例中的
//console.log("item'lable:["+store.getLabel(item)+"] 
//attributes.length="+attributes.length);
//你alert(attributes.length)返回值就是object 
//你如果用console.log(attributes.length)控制台输出就是3

	var gotContinents = function(items, request){   
					    //Cycle over all the matches.   
					    for(var i = 0; i &lt; items.length; i++){   
					        var item = items[i];   
					  
					        //Cycle over all the attributes.   
					        var attributes = store.getAttributes(item);   
					        console.log("item'lable:["+store.getLabel(item)+"] attributes.length="+attributes.length);
					        for (var j = 0; j &lt; attributes.length; j++){   
					            //Assume all attributes are multi-valued and loop over the values ...   
					            var values = store.getValues(item, attributes[j]);   				
					            console.log("item'lable:["+store.getLabel(item)+"] values.length="+values.length);
					            for(var k = 0; k &lt; values.length; k++){   
					                var value = values[k];   
					                   
					                if(store.isItem(value)){   
					                    //Test to see if the items data is fully loaded or needs to be demand-loaded in (the item in question is just a stub).   
					                    if(store.isItemLoaded(value)){   
					                        console.log("Located a child item with label: [" + store.getLabel(value) + "]");   
					                    }else{   
					                        //Asynchronously load in the child item using the stub data to get the real data.   
					                        var lazyLoadComplete = function(item){   
					                            console.log("Lazy-Load of item complete.  Located child item with label: [" + store.getLabel(item) + "]");   
					                        }   
					                        store.loadItem({item: value, onItem: lazyLoadComplete});   
					                    }   
					                }else{   
					                    console.log("Attribute: [" + attributes[j] + "] has value: [" + value + "]");   
					                }   
					            }              
					        }   
					    }   
					}   
					  
					//Call the fetch of the toplevel continent items.   
					store.fetch({query: {type: "continent"}, onComplete: gotContinents});  
//这个函数很神奇，有3个需要说明：
//query: {type: "continent"} 意思就是在test.json中获取所有type: "continent"的items 显//然只有一条记录： { name:'Africa', type:'continent',
//           children:[{_reference:'Egypt'}, {_reference:'Sudan'}] }
//onComplete: gotContinents  这个onComplete 是fetch的一个参数，意识就是当
//前面这个query查询完成后调用gotContinents  函数
//store.fetch() 简单的说，就是当你需要查询json的时候，把查询语句，和一个处理函
//数放里面;值得说明的是，这个函数是异步调用的，也就是说，可能在一些情况下并不是每
//个元素都被加载完了，这也是为什么上面gotContinents函数里面会有
//if(store.isItemLoaded(value)){} 的原因
}
</pre><br />运行结果：<br /><pre name="code" class="js">
item'lable:[Africa] attributes.length=3
item'lable:[Africa] values.length=1
Attribute: [name] has value: [Africa]
item'lable:[Africa] values.length=1
Attribute: [type] has value: [continent]
item'lable:[Africa] values.length=2
Located a child item with label: [Egypt]
Located a child item with label: [Sudan]
</pre><br />最后一点说明：json文件中：<br /> children:[{_reference:'Egypt'}, {_reference:'Sudan'}] <br />中_reference，这个东西找了很多地方，就只在DOJO的例子看见过，没在其他地方见过，在这里就是说，引用了name:'Egypt'元素。尚不清楚是不是标准JSON里面的结构，或者就是dojo自己定义的结构，清楚的人劳烦解释一下。<br /><br />同时可以参见我转的DOJO BOOK上面的一个例子Nested Items and Lazy Loading（我的翻译是：元素集合之延迟加载），不同的是我给出了运行结果，这样好理解些：http://wangsong76.javaeye.com/blog/189784<br />和本文这个例子是同源的。我是在他的那个例子上改动了一下。
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/190432#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Wed, 07 May 2008 00:59:22 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/190432</link>
        <guid>http://wangsong76.javaeye.com/blog/190432</guid>
      </item>
      <item>
        <title>Nested Items and Lazy Loading</title>
        <author>wangsong76</author>
        <description>
          <![CDATA[
          <br/>
          作者: <a href="http://wangsong76.javaeye.com">wangsong76</a>&nbsp;
          链接：<a href="http://wangsong76.javaeye.com/blog/189784" style="color:red;">http://wangsong76.javaeye.com/blog/189784</a>&nbsp;
          发表时间: 2008年05月05日
          <br/><br/>
          声明：本文系JavaEye网站发布的原创博客文章，未经作者书面许可，严禁任何网站转载本文，否则必将追究法律责任！
          <br/><br/>
          Items can be handled in chunks, as well as streamed in. The other articles about datastores show items as a flat list with no hierarchy. So, what if you want a datastore to represent hierarchical data? And how do you walk across the hierarchy? Walking the hierarchy is, in fact, quite easy to do. The following example shows how to do this using JsonItemStore. <br /><br />Assume a datasource of: <br /><br /><br /><pre name="code" class="js">{ identifier: 'name',
     label: 'name',
     items: [
       { name:'Africa', type:'continent',
           children:[{_reference:'Egypt'}, {_reference:'Kenya'}, {_reference:'Sudan'}] },
       { name:'Egypt', type:'country' },
       { name:'Kenya', type:'country',
           children:[{_reference:'Nairobi'}, {_reference:'Mombasa'}] },
       { name:'Nairobi', type:'city' },
       { name:'Mombasa', type:'city' },
       { name:'Sudan', type:'country',
           children:{_reference:'Khartoum'} },
       { name:'Khartoum', type:'city' },
       { name:'Asia', type:'continent',
           children:[{_reference:'China'}, {_reference:'India'}, {_reference:'Russia'},          {_reference:'Mongolia'}] },
       { name:'China', type:'country' },
       { name:'India', type:'country' },
       { name:'Russia', type:'country' },
       { name:'Mongolia', type:'country' },
       { name:'Australia', type:'continent', population:'21 million',
           children:{_reference:'Commonwealth of Australia'}},
       { name:'Commonwealth of Australia', type:'country', population:'21 million'},
       { name:'Europe', type:'continent',
           children:[{_reference:'Germany'}, {_reference:'France'}, {_reference:'Spain'}, {_reference:'Italy'}] },
       { name:'Germany', type:'country' },
       { name:'France', type:'country' },
       { name:'Spain', type:'country' },
       { name:'Italy', type:'country' },
       { name:'North America', type:'continent',
           children:[{_reference:'Mexico'}, {_reference:'Canada'}, {_reference:'United States of America'}] },
       { name:'Mexico', type:'country',  population:'108 million', area:'1,972,550 sq km',
           children:[{_reference:'Mexico City'}, {_reference:'Guadalajara'}] },
       { name:'Mexico City', type:'city', population:'19 million', timezone:'-6 UTC'},
       { name:'Guadalajara', type:'city', population:'4 million', timezone:'-6 UTC' },
       { name:'Canada', type:'country',  population:'33 million', area:'9,984,670 sq km',
           children:[{_reference:'Ottawa'}, {_reference:'Toronto'}] },
       { name:'Ottawa', type:'city', population:'0.9 million', timezone:'-5 UTC'},
       { name:'Toronto', type:'city', population:'2.5 million', timezone:'-5 UTC' },
       { name:'United States of America', type:'country' },
       { name:'South America', type:'continent',
           children:[{_reference:'Brazil'}, {_reference:'Argentina'}] },
       { name:'Brazil', type:'country', population:'186 million' },
       { name:'Argentina', type:'country', population:'40 million' }
  ]}

</pre><br /><br />The above datasource for JsonItemStore uses references to other items to build the hierarchy. Other datasources and datastores might use different internal representations for hierarchy. But, in this example, notice that the continent type items have children that are countries, which in turn have children that are cities. <br /><br />The following code snippet walks across this hierarchy and displays all country items contained by the continent items: <br /><br /><br /><pre name="code" class="js">var store = new dojo.data.ItemFileReadStore({url: "countries.json"});

//Load completed function for walking across the attributes and child items of the
//located items.
var gotContinents = function(items, request){
    //Cycle over all the matches.
    for(var i = 0; i &lt; items.length; i++){
        var item = items[i];

        //Cycle over all the attributes.
        var attributes = store.getAttributes(item);
        for (var j = 0; j &lt; attributes.length; j++){
            //Assume all attributes are multi-valued and loop over the values ...
            var values = store.getValues(item, attributes[j]);
            for(var k = 0; k &lt; values.length; k++){
                var value = values[k];
                
                if(store.isItem(value)){
                    //Test to see if the items data is fully loaded or needs to be demand-loaded in (the item in question is just a stub).
                    if(store.isItemLoaded(value)){
                        console.log("Located a child item with label: [" + store.getLabel(value) + "]");
                    }else{
                        //Asynchronously load in the child item using the stub data to get the real data.
                        var lazyLoadComplete = function(item){
                            console.log("Lazy-Load of item complete.  Located child item with label: [" + store.getLabel(item) + "]");
                        }
                        store.loadItem({item: value, onItem: lazyLoadComplete});
                    }
                }else{
                    console.log("Attribute: [" + attributes[j] + "] has value: [" + value + "]");
                }
            }           
        }
    }
}

//Call the fetch of the toplevel continent items.
store.fetch({query: {type: "continent"}, onComplete: gotContinents});


</pre><br /><br />RUN in IE6.0 RESULT:<br /><br /><pre name="code" class="jS">Attribute: [name] has value: [Africa]
Attribute: [type] has value: [continent]
Located a child item with label: [Egypt]
Located a child item with label: [Kenya]
Located a child item with label: [Sudan]
Attribute: [name] has value: [Asia]
Attribute: [type] has value: [continent]
Located a child item with label: [China]
Located a child item with label: [India]
Located a child item with label: [Russia]
Located a child item with label: [Mongolia]
Attribute: [name] has value: [Australia]
Attribute: [type] has value: [continent]
Attribute: [population] has value: [21 million]
Located a child item with label: [Commonwealth of Australia]
Attribute: [name] has value: [Europe]
Attribute: [type] has value: [continent]
Located a child item with label: [Germany]
Located a child item with label: [France]
Located a child item with label: [Spain]
Located a child item with label: [Italy]
Attribute: [name] has value: [North America]
Attribute: [type] has value: [continent]
Located a child item with label: [Mexico]
Located a child item with label: [Canada]
Located a child item with label: [United States of America]
Attribute: [name] has value: [South America]
Attribute: [type] has value: [continent]
Located a child item with label: [Brazil]
Located a child item with label: [Argentina]
Tests:

</pre><br /><br /><br /><br />Note: The previous sample also demonstrates how lazy-loading (on-demand) of items can be done through the combination of the isItemLoaded() and loadItem() functions. For a demonstration of a lazy-loading approach that uses an extended version of ItemFileReadStore, see the demo in dojox/data/demos/demo_LazyLoad.html.
          <br/>
          <span style="color:red;">
            <a href="http://wangsong76.javaeye.com/blog/189784#comments" style="color:red;">本文的讨论也很精彩，浏览讨论>></a>
          </span>
          <br/><br/><br/>
          <span style="color:#E28822;">JavaEye推荐</span>
          <br/>
          <ul class='adverts'><li><a href='/adverts/97' target='_blank'><span style="color:blue;font-weight:bold;">Oracle专区上线，有Oracle最新文章，重要下载及知识库等精彩内容，欢迎访问。</span></a></li><li><a href='/adverts/41' target='_blank'><span style="color:red;font-weight:bold;">北京: 千橡集团暨校内网诚聘软件研发工程师</span></a></li><li><a href='/adverts/92' target='_blank'><span style="color:red;font-weight:bold;">快来参加7月17日在成都举行的SOA中国技术论坛</span></a></li><li><a href='/adverts/42' target='_blank'><span style="color:red;font-weight:bold;">搜狐网站诚聘Java、PHP和C++工程师</span></a></li><li><a href='/adverts/106' target='_blank'><span style="color:blue;font-weight:bold;">JavaEye问答大赛开始了！ 从6月23日 至 7月6日，奖品丰厚 ！</span></a></li></ul>
          <br/><br/><br/>
          ]]>
        </description>
        <pubDate>Mon, 05 May 2008 16:20:45 +0800</pubDate>
        <link>http://wangsong76.javaeye.com/blog/189784</link>
        <guid>http://wangsong76.javaeye.com/blog/189784</guid>
      </item>
  </channel>
</rss>