<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>鬼の领地 &#187; Javascript</title>
	<atom:link href="http://blog.upsuper.org/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.upsuper.org</link>
	<description>the place where there are some ghost appearing...</description>
	<lastBuildDate>Wed, 19 Oct 2011 13:21:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>一中2009音乐征集系统 推荐平台</title>
		<link>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/</link>
		<comments>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 06:47:19 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[我的计划]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[学校]]></category>
		<category><![CDATA[福州一中]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=877</guid>
		<description><![CDATA[经过约两周的努力编写和调试，终于在昨天晚上完成了。因为做这个网站的缘故，再次新学习了大量东西，比如 jQuery，以及 Linux 下 Photoshop 的替代品 GIMP 等。同时也权当是一次练手，毕竟很久没写这种东西了。不过这次又一次与 IE 的 bug 及非标准化进行了顽强的斗争…… 我要记录下在这个过程中遇到的种种问题和解决方法，以后再遇到就有地方查了~ 客户端部分 很早就听说了 jQuery，上次看完 wp-codebox 的代码才顿觉 jQuery 的强大，因此这次选择了这个。经过短暂的学习就基本了解了，还是比较简单的。此外，jQuery 的插件库相当强大，里面找到了所有我需要的东西，包括上传文件的插件和播放器的插件等。 编写客户端代码最艰苦的部分就是配色和设计界面，以及在各个浏览器中调试。关于兼容性的问题放在后面说，前面先写点关于 JavaScript 代码的事。 第一个比较有趣的问题是关于浮点数保留精度的问题。虽然保留精度大是件好事，可是 JavaScript 没有如 C 中的 printf 那么方便的东西（不过网上似乎也有类似实现，不过 JavaScript 实现这个东西……还是算了吧……）。而一下把很长很长的浮点数显示在用户面前，也绝对不是件好事。经过搜寻，最后使用下面代码实现： 1 2 3 4 5 6 Number.prototype.fix = function &#40;num&#41; &#123; with &#40;Math&#41; return round&#40;this.valueOf&#40;&#41; * pow&#40;10, num&#41;&#41; / pow&#40;10, num&#41;; &#125;; [...]]]></description>
			<content:encoded><![CDATA[<p>经过约两周的努力编写和调试，终于在昨天晚上完成了。因为做这个网站的缘故，再次新学习了大量东西，比如 jQuery，以及 Linux 下 Photoshop 的替代品 GIMP 等。同时也权当是一次练手，毕竟很久没写这种东西了。不过这次又一次与 IE 的 bug 及非标准化进行了顽强的斗争……</p>
<p>我要记录下在这个过程中遇到的种种问题和解决方法，以后再遇到就有地方查了~<br />
<span id="more-877"></span></p>
<h3>客户端部分</h3>
<p>很早就听说了 jQuery，<a href="http://blog.upsuper.org/modify-code-highlight-plugin/">上次看完 wp-codebox 的代码</a>才顿觉 jQuery 的强大，因此这次选择了这个。经过短暂的学习就基本了解了，还是比较简单的。此外，jQuery 的插件库相当强大，里面找到了所有我需要的东西，包括上传文件的插件和播放器的插件等。</p>
<p>编写客户端代码最艰苦的部分就是配色和设计界面，以及在各个浏览器中调试。关于兼容性的问题放在后面说，前面先写点关于 JavaScript 代码的事。</p>
<p>第一个比较有趣的问题是关于浮点数保留精度的问题。虽然保留精度大是件好事，可是 JavaScript 没有如 C 中的 printf 那么方便的东西（不过网上似乎也有类似实现，不过 JavaScript 实现这个东西……还是算了吧……）。而一下把很长很长的浮点数显示在用户面前，也绝对不是件好事。经过搜寻，最后使用下面代码实现：</p>

<div class="wp_codebox"><table><tr id="p8775"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p877code5"><pre class="javascript" style="font-family:monospace;">Number.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">fix</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">with</span> <span style="color: #009900;">&#40;</span>Math<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> round<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">valueOf</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> pow<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> num<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> pow<span style="color: #009900;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #339933;">,</span> num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
String.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">fix</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">return</span> parseFloat<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fix</span><span style="color: #009900;">&#40;</span>num<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>第二个问题就是关于 MP3 播放器背景的问题。我用的这个播放器插件极具可定制性，背景色和前景色都能定制，不过要求都要使用十六进制的形式传入。为了更好的适应主题颜色，我就使用 jQuery 的 .css 方法在脚本中现场获取当前在 CSS 中定义的前景色和背景色。结果发现，其在 Firefox 内返回的是类似 rgb(0, 0, 0) 这样的颜色表大形式。据说在 Firefox 中永远放回这种形式，而 IE 中则总是返回你实际设置时使用的格式。针对这个问题，我写了下面代码来解决（毋庸置疑，这又是抄的）：</p>

<div class="wp_codebox"><table><tr id="p8776"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p877code6"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> hex <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'00'</span><span style="color: #339933;">;</span>
  n <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span> <span style="color: #339933;">||</span> isNaN<span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'00'</span><span style="color: #339933;">;</span>
  n <span style="color: #339933;">=</span> Math.<span style="color: #660066;">round</span><span style="color: #009900;">&#40;</span>n<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>n <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">255</span><span style="color: #009900;">&#41;</span> n <span style="color: #339933;">=</span> <span style="color: #CC0000;">255</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #3366CC;">'0123456789abcdef'</span>.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">-</span> n <span style="color: #339933;">%</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
         <span style="color: #3366CC;">'0123456789abcdef'</span>.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>n <span style="color: #339933;">%</span> <span style="color: #CC0000;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> color2hex <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">search</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/rgb/i</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    color <span style="color: #339933;">=</span> color.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> color.<span style="color: #660066;">length</span> <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">', '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">return</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> hex<span style="color: #009900;">&#40;</span>color<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'#'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    color <span style="color: #339933;">=</span> color.<span style="color: #660066;">substring</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>color.<span style="color: #660066;">length</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">3</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
             color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span>
             color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> color.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">return</span> color<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>另外就是，为了防止大家大量重复提交同样音乐，这次加入了搜索功能，而且在提交一个音乐的时候就会自动进行搜索，并提示用户检查是否已有相同曲目被提交。至于搜索的实现，采用的是客户端搜索，算法上采用了非常著名而简单的 LCS (Longest common subsequence, 最长公共子序列) 这一 oier 的居家旅行杀人放火必备算法。事实证明，这一算法其实是很有效的~</p>

<div class="wp_codebox"><table><tr id="p8777"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code" id="p877code7"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> lcs<span style="color: #009900;">&#40;</span>str1<span style="color: #339933;">,</span> str2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> str1 <span style="color: #339933;">||</span> <span style="color: #339933;">!</span> str2<span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> arr <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">,</span> j<span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> str1.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> str2.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> j <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>str1.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> str2.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> Math.<span style="color: #660066;">max</span><span style="color: #009900;">&#40;</span>arr<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> i <span style="color: #339933;">&amp;&amp;</span> j <span style="color: #339933;">?</span> arr<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">1</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">return</span> arr<span style="color: #009900;">&#91;</span>str1.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>str2.<span style="color: #660066;">length</span><span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>搜索算法：</p>

<div class="wp_codebox"><table><tr id="p8778"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p877code8"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> search<span style="color: #009900;">&#40;</span>type<span style="color: #339933;">,</span> text<span style="color: #339933;">,</span> callback<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  text <span style="color: #339933;">=</span> text.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> threshold <span style="color: #339933;">=</span> text.<span style="color: #660066;">length</span> <span style="color: #339933;">*</span> <span style="color: #CC0000;">0.25</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> result <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
  getList<span style="color: #009900;">&#40;</span>type<span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> value <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">typeof</span> value <span style="color: #339933;">==</span> <span style="color: #3366CC;">'number'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      callback<span style="color: #009900;">&#40;</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #003366; font-weight: bold;">var</span> itemtext<span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">item</span><span style="color: #339933;">,</span> i<span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> value.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">item</span> <span style="color: #339933;">=</span> value<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
      itemtext <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">source</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">title</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">toLowerCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">len</span> <span style="color: #339933;">=</span> itemtext.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">lcs</span> <span style="color: #339933;">=</span> lcs<span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> itemtext<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span>.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&gt;</span> threshold<span style="color: #009900;">&#41;</span> result.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">item</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    result.<span style="color: #660066;">sort</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>item1<span style="color: #339933;">,</span> item2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&gt;</span> item2.<span style="color: #660066;">lcs</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">lcs</span> <span style="color: #339933;">&lt;</span> item2.<span style="color: #660066;">lcs</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">len</span> <span style="color: #339933;">&lt;</span> item2.<span style="color: #660066;">len</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>item1.<span style="color: #660066;">len</span> <span style="color: #339933;">&gt;</span> item2.<span style="color: #660066;">len</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    callback<span style="color: #009900;">&#40;</span>result<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>还有一个是关于换肤的。<a href="http://blog.upsuper.org/replace-css-based-on-jquery/">上一次有一篇文章</a>测试过了基于更换 link 标签 href 属性换肤的可行性分析，这次就应用于了这个平台上。但在测试中发现 IE 并不像想像的那么完美。事实上，IE 在这个的测试过程中是非常废品的，几乎相当于不能换。经过多次实验，发现原因出在——IE6 在页面加载完毕后永远不会显示其还没有下载的样式信息。也就是说，更改 href 后，虽然 IE6 将原来的样式表无效化了，但此时发现新的样式表不在其缓存中，便拒绝启用新的样式表。但奇怪的是，IE6 这个时候事实上会连接服务器下载新的样式，因此在下一次访问的时候上次点过的皮肤就可以用了。这说明，我们只要要求 IE 预装载以后可能用到的东西就可以了。因此我就在页面底部加入了一个隐藏的 iframe 用于下载样式表和需要的图片。</p>
<p>除此之外，就是一些关于样式的新发现。我第一次知道当一个元素的 position 属性设置为 relative 的时候，对这个对象本身没有影响，但却使得其使用 position 属性的子元素的位移变由相对页面的位移变为相对该元素的位移。这的上传进度条的实现方法便是应用这一机制。</p>
<p>说到上传进度条，不得不说 Uploadify 这一插件真的很强大……我将其默认的上传进度和管理通过对各个必要函数绑定返回 false 来屏蔽掉了。</p>
<p>最后是关于 jQuery 优化的问题。虽然 jQuery 的官方测试表明，jQuery 的效率非常惊人，但优化下总归是有好处的。参考的资料见下面了，说说我大体做了哪些优化吧。一是缓存 jQuery 对象，防止重复调用选择器带来的性能损失。第二个是为选择器加上上下文限制，第三个是将部分效果移至 $(window).load 里。</p>
<p>在客户端的脚本部分的最最后，小小的埋怨一下 JavaScript 这个语言……我觉得实在是没有 Python 优美啊！什么时候 Python 能成为通用的客户端脚本啊，那个时候用 Python 就可以通吃服务器端和客户端了……</p>
<p>说完了脚本，来说说这次的界面。这次界面个人还是很满意的。在界面设计中，我自认为值得一提的是那个圆角，为什么呢？因为我以前一直以为 GIMP 不能画圆角。这次去网上找了才知道，GIMP 远比我想象的强大的多！猜猜圆角是怎么画出来的？是通过高斯模糊+调整色阶。具体的实现方法放在下面参考资料里面了，这里就不详述了。但我真的觉得很强大，虽然 GIMP 和 Photoshop 等商业软件还有差距，不过对于我来说，看来足够了。</p>
<p>最后再提下这次发现的不同浏览器的兼容性问题：</p>
<dl>
<dt>对于不显示的 Flash，IE 无法与其交互</dt>
<dt>对于曾经被隐藏但再次出现的 Flash，IE6 无法与其交互</dt>
<dd>解决方案：完全销毁原有 Flash 对象并重建</dd>
<dt>IE 中隐藏的 Flash MP3 播放器可以发出声音，但 Firefox 不行</dt>
<dd>解决方案：统一的办法就是直接销毁播放器，而非单单让其隐藏</dd>
<dt>IE 的 JavaScript 解析器不支持用 [index] 的方式索引字符</dt>
<dd>解决方案：使用原有标准的 .charAt(index) 方式索引</dd>
<dt>在 IE6 中，显示时尚未下载完成的 CSS 元素永远不会显示（如背景图片）</dt>
<dd>解决方案：在页面中加入一个隐藏的 iframe 用于预加载</dd>
<dt>IE6 中的双倍外边距 bug</dt>
<dd>解决方案：给相应对象加上 display:inline; 属性，或通过 hack 专门调低在 IE6 下的外边距</dd>
<dt>IE6 对于 display 的 inline-block 属性支持不完善</dt>
<dd>解决方案：给相应对象加上 zoom:1; 属性</dd>
<dt>IE6 不支持半透明的 png 图片</dt>
<dd>解决方案：采用 IE 专有的过滤器 filter:progid:DXImageTransform.Microsoft.AlphaImageLoader 可以完美解决</dd>
</dl>
<p>IE 的兼容性烦死人啊……看看我的 ie6-fix.css 和 ie7-fix.css 就知道了……</p>
<h4>使用部件</h4>
<ul>
<li><a href="http://jquery.com/">jQuery: The Write Less, Do More, JavaScript Library</a></li>
<li><a href="http://www.uploadify.com/">Uploadify &#8211; jQuery File Upload Plugin Script</a></li>
<li><a href="http://code.google.com/p/swfobject/">SWFObject</a></li>
<li><a href="http://www.sean-o.com/jquery/jmp3/">jMP3: Sean O&#8217;s JavaScript MP3 Player / jQuery plugin</a></li>
<li><a href="http://code.google.com/p/jquery-json/">JSON plugin for jQuery</a></li>
</ul>
<h4>参考资料</h4>
<ul>
<li><a href="http://www.k99k.com/jQuery_getting_started.html">jQuery中文入门教程</a></li>
<li><a href="http://topic.csdn.net/t/20031109/21/2443654.html">如何格式化浮点数计算结果 JavaScript &#8211; CSDN社区</a></li>
<li><a href="http://plugins.jquery.com/files/jquery.sifr.js_1.txt">jQuery.sifrSettings</a></li>
<li><a href="http://www.rainbk.net/post/199.html">jQuery性能优化指南 (全部) &#8211; 烟雨博客</a></li>
<li><a href="http://blog.chinaunix.net/u1/55011/showart.php?id=468782">1.3 圆整圆角 &#8211; The Gimp &#8211; 思魂轩</a></li>
<li><a href="http://www.uploadify.com/forum/viewtopic.php?f=7&#038;t=1878">Uploadify &bull; View topic &#8211; Uploadify doesnt fire uploadifyUpload/uploadifyClearQueue</a></li>
<li><a href="http://feiyu.asgard.cn/article_157.html">IE6下margin双倍问题 &#8211; 绯雨的天空</a></li>
<li><a href="http://www.howtocreate.co.uk/alpha.html">Making Internet Explorer use PNG Alpha transparency</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/2009-recommend-platform-of-music-recruiter-for-fuzhou-no1-middle-school/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>对字符串加长和数组合并的效率比较</title>
		<link>http://blog.upsuper.org/lengthening-of-the-string-and-compare-the-efficiency-of-the-combined-array/</link>
		<comments>http://blog.upsuper.org/lengthening-of-the-string-and-compare-the-efficiency-of-the-combined-array/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 04:59:02 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[探究学习]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[效率]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=674</guid>
		<description><![CDATA[对于字符串累加的处理，在 PHP 或 JavaScript 中似乎都可以通过类似 += (.= for PHP) 的方式实现，但有不少人抱怨道，这种方式效率很低。事实上，在我还在用 VB 的时候我就注意到这样的效率很低，当时的效率低是因为累加需要反复申请内存，而解决方法也很简单，就是用 Space$ 命令事先申请内存，然后用 Mid$ 来修改，这样效率大大提高！ 然而在这里就不一样了，PHP 和 JavaScript 的内存机制我不是非常了解，同时我们似乎也不再使用预申请的方法来加速了（似乎也比较困难……），而是直接用上了 += 这样的符号。 下面就是问题了：这样的效率低吗？ 很多人（包括我自己最初）根据自己的想象，认为使用添加数组内容，最后合并数组为字符串，这样效率比简单的 += 要快，但我经过反复实验认为并不是这样的。首先是 JavaScript，我使用的测试代码如下： 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 function getTime&#40;&#41; &#123; [...]]]></description>
			<content:encoded><![CDATA[<p>对于字符串累加的处理，在 PHP 或 JavaScript 中似乎都可以通过类似 += (.= for PHP) 的方式实现，但有不少人抱怨道，这种方式效率很低。事实上，在我还在用 VB 的时候我就注意到这样的效率很低，当时的效率低是因为累加需要反复申请内存，而解决方法也很简单，就是用 Space$ 命令事先申请内存，然后用 Mid$ 来修改，这样效率大大提高！</p>
<p>然而在这里就不一样了，PHP 和 JavaScript 的内存机制我不是非常了解，同时我们似乎也不再使用预申请的方法来加速了（似乎也比较困难……），而是直接用上了 += 这样的符号。</p>
<p>下面就是问题了：这样的效率低吗？<br />
<span id="more-674"></span><br />
很多人（包括我自己最初）根据自己的想象，认为使用添加数组内容，最后合并数组为字符串，这样效率比简单的 += 要快，但我经过反复实验认为并不是这样的。首先是 JavaScript，我使用的测试代码如下：</p>

<div class="wp_codebox"><table><tr id="p67413"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
</pre></td><td class="code" id="p674code13"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> getTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> testit<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>i<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		st <span style="color: #339933;">=</span> getTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		t <span style="color: #339933;">=</span> <span style="color: #3366CC;">''</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">100000</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			t <span style="color: #339933;">+=</span> <span style="color: #3366CC;">'test'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		et <span style="color: #339933;">=</span> getTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>et <span style="color: #339933;">-</span> st<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\t</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		st <span style="color: #339933;">=</span> getTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		a <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>j <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">100000</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span>j<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			a.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		t <span style="color: #339933;">=</span> a.<span style="color: #660066;">join</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		et <span style="color: #339933;">=</span> getTime<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span>et <span style="color: #339933;">-</span> st<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>以下是我在 Firefox 3.0.6 下执行的结果：</p>

<div class="wp_codebox"><table><tr id="p67414"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p674code14"><pre class="text" style="font-family:monospace;">196	207
195	215
199	203
196	203
200	197
110	111
104	111
107	111
108	113
105	107</pre></td></tr></table></div>

<p>可以看出，+= 的效率并不比数组合并低，甚至略快于数组合并。</p>
<p>下面我们看看 PHP 呢？</p>
<p>下面是测试用 PHP 代码：</p>

<div class="wp_codebox"><table><tr id="p67415"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p674code15"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$st</span> <span style="color: #339933;">=</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10000</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$str</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'test'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$et</span> <span style="color: #339933;">=</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%.7F</span><span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$et</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$st</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$st</span> <span style="color: #339933;">=</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">10000</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'test'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$et</span> <span style="color: #339933;">=</span> <span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #009933; font-weight: bold;">%.7F</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$et</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$st</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>结果则如下：</p>

<div class="wp_codebox"><table><tr id="p67416"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p674code16"><pre class="text" style="font-family:monospace;">0.0039599	0.0461071
0.0070710	0.0408709
0.0052779	0.0322330
0.0061541	0.0294971
0.0051920	0.0230181
0.0039949	0.0204601
0.0038750	0.0246589
0.0043111	0.0245950
0.0047810	0.0232542
0.0038841	0.0230379</pre></td></tr></table></div>

<p>可以看出，数组合并的效率远低于字符串直接叠加！</p>
<p>上一次用 spidermonkey-bin 中的 js 命令做了一下实验，结果在这种条件下，字符串叠加的效率也是远优于数组合并，而不像在 Firefox 中这样。</p>
<p>我对于这些脚本语言对字符串和数组的具体实现机理不是很清楚，但可以肯定的是，个个常用的脚本引擎都对字符串处理做了许多优化，我猜测（因为 Ubuntu 下暂时没有 stable 的 Chrome）Chrome 的 V8 引擎中，字符串直接叠加的效率将继续远超数组。因此，我们不应该想当然地认为某某方式效率高，而应该用测试结果说话……</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/lengthening-of-the-string-and-compare-the-efficiency-of-the-combined-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 没有不能运行的脚本</title>
		<link>http://blog.upsuper.org/there-is-no-script-that-cannot-run-on-linux/</link>
		<comments>http://blog.upsuper.org/there-is-no-script-that-cannot-run-on-linux/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 14:21:20 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[雕虫小技]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=670</guid>
		<description><![CDATA[很早以前，我就知道，在 Windows 里面我们可以直接运行非二进制文件的 bat/cmd 命令行文件，还有那个 vbs 脚本文件。 到了 Linux，我发现，在这里，每一样都比 Windows 里面先进……虽然不能运行 vbs 或 bat/cmd，但这里有 bash、python、perl、ruby…… 好吧，我承认还是有脚本不行的，但 Linux 下即使 bash 都比 vbs 强大…… 后来知道了 php 也可以……php-cli 模式可以在 Linux 下直接执行 php 脚本。 今天又知道了……原来 JavaScript 脚本也可以直接执行。先是把一个 JavaScript 脚本设置为可执行，但是没法运行。然后到 bash 中找什么命令能执行 JavaScript……我试了一下 javascript 命令，没有，又试了下 js，bash 提示我，在 spidermonkey-bin 包中包含这个命令。联想到刚刚看过一个资料说到 Spidermonkey 是 Firefox 的脚本解析器，我就用 apt 安装了个（今天新加的网易源实在太快了！） 随后，修改了一下脚本，大约是这个样子的： 1 2 #!/usr/bin/js print&#40;&#34;Hello [...]]]></description>
			<content:encoded><![CDATA[<p>很早以前，我就知道，在 Windows 里面我们可以直接运行非二进制文件的 bat/cmd 命令行文件，还有那个 vbs 脚本文件。</p>
<p>到了 Linux，我发现，在这里，每一样都比 Windows 里面先进……虽然不能运行 vbs 或 bat/cmd，但这里有 bash、python、perl、ruby……<br />
好吧，我承认还是有脚本不行的，但 Linux 下即使 bash 都比 vbs 强大……</p>
<p>后来知道了 php 也可以……php-cli 模式可以在 Linux 下直接执行 php 脚本。</p>
<p>今天又知道了……原来 JavaScript 脚本也可以直接执行。先是把一个 JavaScript 脚本设置为可执行，但是没法运行。然后到 bash 中找什么命令能执行 JavaScript……我试了一下 javascript 命令，没有，又试了下 js，bash 提示我，在 spidermonkey-bin 包中包含这个命令。联想到刚刚看过<a href="http://tech.sina.com.cn/s/2008-07-21/1734740604.shtml">一个资料</a>说到 Spidermonkey 是 Firefox 的脚本解析器，我就用 apt 安装了个（今天新加的网易源实在太快了！）</p>
<p>随后，修改了一下脚本，大约是这个样子的：</p>

<div class="wp_codebox"><table><tr id="p67018"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p670code18"><pre class="javascript" style="font-family:monospace;">#<span style="color: #339933;">!/</span>usr<span style="color: #339933;">/</span>bin<span style="color: #339933;">/</span>js
<span style="color: #000066;">print</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello world!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>执行，在 bash 中输出了 Hello world! 太高兴了！</p>
<p>Linux 下真是没有不能执行的脚本，Windows 永远也比不上……<br />
我就不理解了，这么先进的 Linux 怎么就没什么人用呢？多少功能比 Windows 方便……</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/there-is-no-script-that-cannot-run-on-linux/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>修改 ASCIIMathML.js 适应 Discuz! 6.0</title>
		<link>http://blog.upsuper.org/edit-asciimathml-js-for-discuz-6/</link>
		<comments>http://blog.upsuper.org/edit-asciimathml-js-for-discuz-6/#comments</comments>
		<pubDate>Sun, 31 Aug 2008 03:17:00 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[雕虫小技]]></category>
		<category><![CDATA[Discuz!]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MathML]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=590</guid>
		<description><![CDATA[前几天，一位大牛 (Mathself) 提议给论坛安装上一个数学插件，并且告诉我参看奥数之家论坛。我经过研究发现，就是一个叫做 ASCIIMathML.js 的文件在起作用，这个文件将类 LaTeX 的公式转换为 MathML。Firefox 提供原声的 MathML 支持，而 IE8 以下的版本需要 MathPlayer 插件支持，Opera 自 9.5 起提供原生的 MathML 支持。 经过研究，首先发现，ASCIIMathML.js 默认不提供 Opera 的支持，对 ASCIIMathML.js先做了点小修改： 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 function AMisMathMLavailable&#40;&#41; &#123; if &#40;navigator.appName.slice&#40;0,8&#41;==&#34;Netscape&#34;&#41; if &#40;navigator.appVersion.slice&#40;0,1&#41;&#62;=&#34;5&#34;&#41; return null; else return AMnoMathMLNote&#40;&#41;; else if &#40;window.opera&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>前几天，一位大牛 (Mathself) 提议给论坛安装上一个数学插件，并且告诉我参看<a href="http://www.aoshoo.com/bbs1/index.asp" target="_blank">奥数之家论坛</a>。我经过研究发现，就是一个叫做 ASCIIMathML.js 的文件在起作用，这个文件将类 LaTeX 的公式转换为 MathML。Firefox 提供原声的 MathML 支持，而 IE8 以下的版本需要 MathPlayer 插件支持，Opera 自 9.5 起提供原生的 MathML 支持。<br />
<span id="more-590"></span><br />
经过研究，首先发现，ASCIIMathML.js 默认不提供 Opera 的支持，对 ASCIIMathML.js先做了点小修改：</p>

<div class="wp_codebox"><table><tr id="p59022"><td class="line_numbers"><pre>75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
</pre></td><td class="code" id="p590code22"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> AMisMathMLavailable<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">appName</span>.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">8</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;Netscape&quot;</span><span style="color: #009900;">&#41;</span> 
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">appVersion</span>.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&gt;=</span><span style="color: #3366CC;">&quot;5&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">return</span> AMnoMathMLNote<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">opera</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">appName</span>.<span style="color: #660066;">slice</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;Microsoft&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #003366; font-weight: bold;">var</span> ActiveX <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;MathPlayer.Factory.1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">return</span> AMnoMathMLNote<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">return</span> AMnoMathMLNote<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>不过话说 Opera 对 MathML 的支持实在有限……感觉看起来很囧的说……</p>
<p>把这个弄到服务器以后，我就钻空子注册了一个带公式的用户名。结果 Doggy 瞬间出台规定禁止……我说还不如从代码上禁用……又经过一番研究，发觉只要改 ASCIIMathML.js 的代码就可以了，下面是研究成果：首先是修改 onLoad 直接调用的 generic：</p>

<div class="wp_codebox"><table><tr id="p59023"><td class="line_numbers"><pre>903
904
905
906
</pre></td><td class="code" id="p590code23"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> generic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  translate<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>那个 true 表示仅转换需要的地方。</p>
<p>然后是修改处理的地方：</p>

<div class="wp_codebox"><table><tr id="p59024"><td class="line_numbers"><pre>861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
</pre></td><td class="code" id="p590code24"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> AMprocessNode<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">,</span> linebreaks<span style="color: #339933;">,</span> spanclassAM<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> frag<span style="color: #339933;">,</span>st<span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>spanclassAM<span style="color: #339933;">!=</span><span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    frag <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>frag.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>frag<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">className</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;t_msgfont&quot;</span><span style="color: #009900;">&#41;</span>
        AMprocessNodeR<span style="color: #009900;">&#40;</span>frag<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>linebreaks<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
      st <span style="color: #339933;">=</span> n.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>st<span style="color: #339933;">==</span><span style="color: #003366; font-weight: bold;">null</span> <span style="color: #339933;">||</span> 
        st.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>AMdelimiter1<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">||</span> st.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>AMdelimiter2<span style="color: #009900;">&#41;</span><span style="color: #339933;">!=-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> 
      AMprocessNodeR<span style="color: #009900;">&#40;</span>n<span style="color: #339933;">,</span>linebreaks<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>isIE<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//needed to match size and font of formula to surrounding text</span>
    frag <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'math'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>i<span style="color: #339933;">&lt;</span>frag.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> frag<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">update</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>为什么这样改呢……因为在 Discuz! 里面帖子内容都是在 div 标签里……而且这些标签有一个共同特征，那就是有 t_msgfont 这个 class！于是这样改完，就可以仅仅在帖子内容中使用 MathML 了！</p>
<p>我是根据很早以前的 1.4.7 版本改的……虽然据说有很新的版本……2.x 什么的……不想管了……<br />
如果不想自己改的话，直接从这里下载改好的文件：<a href="http://www.fzyz.cn/forum/include/javascript/ASCIIMathML.js">ASCIIMathML.js</a>。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/edit-asciimathml-js-for-discuz-6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>the Ship of Culture, we are ready!</title>
		<link>http://blog.upsuper.org/the-ship-of-culture-we-are-ready/</link>
		<comments>http://blog.upsuper.org/the-ship-of-culture-we-are-ready/#comments</comments>
		<pubDate>Sat, 24 May 2008 15:36:09 +0000</pubDate>
		<dc:creator>upsuper</dc:creator>
				<category><![CDATA[琐事杂谈]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mondialogo]]></category>
		<category><![CDATA[排版]]></category>
		<category><![CDATA[网站]]></category>

		<guid isPermaLink="false">http://blog.upsuper.org/?p=97</guid>
		<description><![CDATA[今天基本完成了我网页制作的任务，其他人的幻灯片和书应该也基本完成了。刚刚把那个上传的上面：http://mondialogo.upsuper.org/。 最早是Neipoor初稿设计的，后来为了体现交流，对其设计做了些许修改，就成了现在的样子。主要修改在几个地方：一是宽度由原来的1024减为980；然后是在那边加了两国国旗；还有就是给那三行字加了我很喜欢的投影效果~另外就是加了很美的鼠标放到链接上时会有发亮的效果，不过IE不支持（使用IE7测试），我的Firefox和Opera都支持。据说支持没有href属性的标签使用hover伪类是CSS2的特性，所以IE不能完全支持……另外就是加了下面的footer，是我后来使用Neipoor留下的素材独立制作的，个人觉得效果蛮赞的说。 这次里面的导航栏完全没有使用A标签或者MAP标签，而是用了新的方式——DIV+Javascript。我个人觉得这种很大的好处是链接放置的位置相当自由，而且很符合我要在背景图上放链接的要求。这次的排版是靠TABLE排的，不过可以几乎认为是absoluted的DIV。个人觉得这次做的不错~]]></description>
			<content:encoded><![CDATA[<p>今天基本完成了我网页制作的任务，其他人的幻灯片和书应该也基本完成了。刚刚把那个上传的上面：<a href="http://mondialogo.upsuper.org/">http://mondialogo.upsuper.org/</a>。</p>
<p>最早是Neipoor初稿设计的，后来为了体现交流，对其设计做了些许修改，就成了现在的样子。主要修改在几个地方：一是宽度由原来的1024减为980；然后是在那边加了两国国旗；还有就是给那三行字加了我很喜欢的投影效果~另外就是加了很美的鼠标放到链接上时会有发亮的效果，不过IE不支持（使用IE7测试），我的Firefox和Opera都支持。据说支持没有href属性的标签使用hover伪类是CSS2的特性，所以IE不能完全支持……另外就是加了下面的footer，是我后来使用Neipoor留下的素材独立制作的，个人觉得效果蛮赞的说。</p>
<p>这次里面的导航栏完全没有使用A标签或者MAP标签，而是用了新的方式——DIV+Javascript。我个人觉得这种很大的好处是链接放置的位置相当自由，而且很符合我要在背景图上放链接的要求。这次的排版是靠TABLE排的，不过可以几乎认为是absoluted的DIV。个人觉得这次做的不错~</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.upsuper.org/the-ship-of-culture-we-are-ready/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

