<?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>Austin&#039;s Note</title>
	<atom:link href="http://blog.gclin.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gclin.org</link>
	<description>全新的正體中文 WordPress 網誌！</description>
	<lastBuildDate>Tue, 13 Apr 2010 12:11:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://blog.gclin.org/wp-includes/js/jquery/jquery.js?ver=1.3.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>Using Boost libraries with Visual Studio 2008</title>
		<link>http://blog.gclin.org/2010/04/13/boost-libraries-visual-studio/</link>
		<comments>http://blog.gclin.org/2010/04/13/boost-libraries-visual-studio/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 12:07:02 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[Boost]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=881</guid>
		<description><![CDATA[網站：Boost C++ Libraries(下載)
Step 1. 取得Boost libraries
到網站的Download去下載，然後解壓縮(D:/boost_1_42_0)
Step 2. 建置Bjam
進入D:/boost_1_42_0，然後執行bootstrap.bat
跑完之後在這個目錄就會多出一個bjam.exe
Step 3. 建置Boost Libraries
在D:/boost_1_42_0建立一個buildall_vc90.bat內容如下

1
2
bjam toolset=msvc-9.0 variant=debug threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION
bjam toolset=msvc-9.0 variant=release threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION

執行剛剛建立的那個buildall_vc90.bat，等他跑完在D:\boost_1_42_0\stage\lib應該有一堆*.lib、*.dll
Step 4. 設定Visual Studio 2008
開啟Visual Studio 2008，工具 => 選項 => 專案和方案 => VC++目錄
顯示目錄的那個下拉選單
選Include檔案加入D:\boost_1_42_0
選程式庫檔加入D:\boost_1_42_0\stage\lib
]]></description>
			<content:encoded><![CDATA[<p>網站：<a href="http://www.boost.org/" target="_blank">Boost C++ Libraries</a>(<a href="http://www.boost.org/users/download/" target="_blank">下載</a>)</p>
<p><strong>Step 1. 取得Boost libraries</strong><br />
到網站的Download去下載，然後解壓縮(D:/boost_1_42_0)</p>
<p><strong>Step 2. 建置Bjam</strong><br />
進入D:/boost_1_42_0，然後執行bootstrap.bat<br />
跑完之後在這個目錄就會多出一個bjam.exe</p>
<p><strong>Step 3. 建置Boost Libraries</strong><br />
在D:/boost_1_42_0建立一個buildall_vc90.bat內容如下</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="batch" style="font-family:monospace;">bjam toolset=msvc-9.0 variant=debug threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION
bjam toolset=msvc-9.0 variant=release threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION</pre></td></tr></table></div>

<p>執行剛剛建立的那個buildall_vc90.bat，等他跑完在D:\boost_1_42_0\stage\lib應該有一堆*.lib、*.dll</p>
<p><strong>Step 4. 設定Visual Studio 2008</strong><br />
開啟Visual Studio 2008，工具 => 選項 => 專案和方案 => VC++目錄<br />
顯示目錄的那個下拉選單<br />
選<strong>Include檔案</strong>加入<strong>D:\boost_1_42_0</strong><br />
選<strong>程式庫檔</strong>加入<strong>D:\boost_1_42_0\stage\lib</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2010/04/13/boost-libraries-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stack overflow</title>
		<link>http://blog.gclin.org/2010/03/17/stack-overflow/</link>
		<comments>http://blog.gclin.org/2010/03/17/stack-overflow/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 17:19:21 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[Heap]]></category>
		<category><![CDATA[Stack]]></category>
		<category><![CDATA[Stack overflow]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=849</guid>
		<description><![CDATA[最近遇到的一個問題Stack overflow，不難解~改用new＆delete就對了丫，結果還是錯，找了一下資料是用new＆delete沒錯，但是為啥不行，最後發現原來還有別的地方有用一樣的數字來宣告，程式如下：
一開始找出來發生錯誤的地方(我一直以為是這錯@@a)

1
2
3
4
5
6
7
const unsigned int numSolution1 = 50;
&#160;
// 掛
Solution sol1&#91;numSolution1&#93;;
&#160;
// 正常來說改成這樣就OK了，結果調成100還是會掛
Solution *sol1 = new Solution&#91;numSolution1&#93;;

最後發現~另外還有幾個個檔案有類似下面的程式：

1
2
3
// 掛，因為這邊也要改用new
const unsigned int numSolution2 = numSolution1 * 2;
Solution sol2&#91;numSolution2&#93;;

　
Stack overflow
Compile時會過，執行時會錯@@
錯誤訊息：. . . . . . 發生未處理的例外狀況: 0xC00000FD: Stack overflow
主要原因是因為Stack有大小限制，而且我們一般直接宣告出來的變數是放在Stack，如果在Stack放出大量資料，就會發生Stack overflow，解決方法就是改用new＆delete，這樣一來資料就會改成用heap來儲存，也就不會受限於Stack的大小了。只是速度也比較慢，另外要特別注意記得要delete。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// 下面四個for的cup time都介於0.25s左右
for&#40;unsigned int i = 0; i &#60; 100000000; ++i&#41; &#123;
	int sol&#91;20&#93;;
&#125;
&#160;
for&#40;unsigned int i = 0; i &#60; 250000; ++i&#41; &#123;
	int [...]]]></description>
			<content:encoded><![CDATA[<p>最近遇到的一個問題Stack overflow，不難解~改用new＆delete就對了丫，結果還是錯，找了一下資料是用new＆delete沒錯，但是為啥不行，最後發現原來還有別的地方有用一樣的數字來宣告，程式如下：<br />
一開始找出來發生錯誤的地方(我一直以為是這錯@@a)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">const</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> numSolution1 <span style="color: #000080;">=</span> <span style="color: #0000dd;">50</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// 掛</span>
Solution sol1<span style="color: #008000;">&#91;</span>numSolution1<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #666666;">// 正常來說改成這樣就OK了，結果調成100還是會掛</span>
Solution <span style="color: #000040;">*</span>sol1 <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> Solution<span style="color: #008000;">&#91;</span>numSolution1<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span></pre></td></tr></table></div>

<p>最後發現~另外還有幾個個檔案有類似下面的程式：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">// 掛，因為這邊也要改用new</span>
<span style="color: #0000ff;">const</span> <span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> numSolution2 <span style="color: #000080;">=</span> numSolution1 <span style="color: #000040;">*</span> <span style="color: #0000dd;">2</span><span style="color: #008080;">;</span>
Solution sol2<span style="color: #008000;">&#91;</span>numSolution2<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span></pre></td></tr></table></div>

<p><span id="more-849"></span>　<br />
<strong>Stack overflow</strong><br />
Compile時會過，執行時會錯@@<br />
錯誤訊息：. . . . . . 發生未處理的例外狀況: 0xC00000FD: Stack overflow<br />
主要原因是因為Stack有大小限制，而且我們一般直接宣告出來的變數是放在Stack，如果在Stack放出大量資料，就會發生Stack overflow，解決方法就是改用new＆delete，這樣一來資料就會改成用heap來儲存，也就不會受限於Stack的大小了。只是速度也比較慢，另外要特別注意記得要delete。</p>

<div class="wp_syntax"><table><tr><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"><pre class="cpp" style="font-family:monospace;"><span style="color: #666666;">// 下面四個for的cup time都介於0.25s左右</span>
<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">100000000</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> sol<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">250000</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">int</span> <span style="color: #000040;">*</span>sol <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> <span style="color: #0000ff;">int</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> sol<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">100000000</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	Solution sol<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">2500</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	Solution <span style="color: #000040;">*</span>sol <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> Solution<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
	<span style="color: #0000dd;">delete</span> <span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> sol<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>　<br />
參考資料：<a target="_blank" href="http://godman362.blogspot.com/2008/08/heapstack.html">堆(heap)和棧(stack)</a>、<a target="_blank" href="http://www.wretch.cc/blog/ahongyeh/28870839">MFC &#8211; STACK溢位</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2010/03/17/stack-overflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install Intel C++ Compiler on Ubuntu 9.10(64bit)</title>
		<link>http://blog.gclin.org/2010/03/15/install-intel-c-compiler-on-ubuntu-9-1064bit/</link>
		<comments>http://blog.gclin.org/2010/03/15/install-intel-c-compiler-on-ubuntu-9-1064bit/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 02:54:56 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Compiler]]></category>
		<category><![CDATA[Intel C++]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=832</guid>
		<description><![CDATA[安裝相關套件：

1
2
3
4
5
6
7
8
# 必要套件
sudo apt-get install gcc build-essential g++ rpm
&#160;
# this is only required on 64bit Ubuntu/Debian systems
sudo apt-get install ia32-libs
&#160;
# For use the Intel IDB graphical debugger
sudo apt-get install openjdk-6-jre-headless

Ubuntu 9.10後改用libstdc++6，而Install Intel C++ Compiler需要libstdc++5，所以要另外安裝。先到http://packages.debian.org/stable/base/libstdc++5下載adm64的版本用dpkg安裝，再下載i386解開，並取出函式庫

1
2
3
4
5
6
7
8
9
10
11
12
13
# 下載並adm64的版本
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_amd64.deb
sudo dpkg -i libstdc++5_3.3.6-18_amd64.deb
&#160;
# 下載i386並解開
wget http://debian.linux.org.tw/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb
dpkg --extract libstdc++5_3.3.6-18_i386.deb ./
&#160;
# 出函式庫
cd usr/lib
sudo cp libstdc++.so.5.0.7 /usr/lib32
cd /usr/lib32
sudo ln -s libstdc++.so.5.0.7 libstdc++.so.5

然後就可進入Install Intel C++ [...]]]></description>
			<content:encoded><![CDATA[<p><strong>安裝相關套件：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># 必要套件</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> build-essential <span style="color: #c20cb9; font-weight: bold;">g++</span> rpm
&nbsp;
<span style="color: #666666; font-style: italic;"># this is only required on 64bit Ubuntu/Debian systems</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ia32-libs
&nbsp;
<span style="color: #666666; font-style: italic;"># For use the Intel IDB graphical debugger</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openjdk-<span style="color: #000000;">6</span>-jre-headless</pre></td></tr></table></div>

<p>Ubuntu 9.10後改用libstdc++6，而Install Intel C++ Compiler需要libstdc++5，所以要另外安裝。先到<a target="_blank" href="http://packages.debian.org/stable/base/libstdc++5">http://packages.debian.org/stable/base/libstdc++5</a>下載adm64的版本用dpkg安裝，再下載i386解開，並取出函式庫</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># 下載並adm64的版本</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>debian.linux.org.tw<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>pool<span style="color: #000000; font-weight: bold;">/</span>main<span style="color: #000000; font-weight: bold;">/</span>g<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">/</span>libstdc++<span style="color: #000000;">5</span>_3.3.6-<span style="color: #000000;">18</span>_amd64.deb
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> libstdc++<span style="color: #000000;">5</span>_3.3.6-<span style="color: #000000;">18</span>_amd64.deb
&nbsp;
<span style="color: #666666; font-style: italic;"># 下載i386並解開</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>debian.linux.org.tw<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>pool<span style="color: #000000; font-weight: bold;">/</span>main<span style="color: #000000; font-weight: bold;">/</span>g<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">3.3</span><span style="color: #000000; font-weight: bold;">/</span>libstdc++<span style="color: #000000;">5</span>_3.3.6-<span style="color: #000000;">18</span>_i386.deb
<span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">--extract</span> libstdc++<span style="color: #000000;">5</span>_3.3.6-<span style="color: #000000;">18</span>_i386.deb .<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># 出函式庫</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> usr<span style="color: #000000; font-weight: bold;">/</span>lib
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> libstdc++.so.5.0.7 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib32
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib32
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> libstdc++.so.5.0.7 libstdc++.so.5</pre></td></tr></table></div>

<p>然後就可進入Install Intel C++ Compiler的安裝了，裝完之後把下面指令加入到.bashrc即可直接使用icc</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>intel<span style="color: #000000; font-weight: bold;">/</span>Compiler<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">11.1</span><span style="color: #000000; font-weight: bold;">/</span>069<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>iccvars.sh intel64</pre></td></tr></table></div>

<p>　</p>
<p>參考資料：<a target="_blank" href="http://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/">Using Intel Compilers for Linux with Ubuntu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2010/03/15/install-intel-c-compiler-on-ubuntu-9-1064bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flowplayer + BlockUI</title>
		<link>http://blog.gclin.org/2010/02/11/flowplayer-blockui/</link>
		<comments>http://blog.gclin.org/2010/02/11/flowplayer-blockui/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 21:50:44 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[BlockUI]]></category>
		<category><![CDATA[Flowplayer]]></category>
		<category><![CDATA[Player]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=816</guid>
		<description><![CDATA[網站：Flowplayer、BlockUI
下載：Flowplayer 3.1.5.zip、BlockUI 2.31
之前使用的線上播放器是JW Player，但是他在某個版本開始(很久了)，限制非商業行為才能免費使用(應該不是我之前沒注意到吧@@)，之後發現了Flowplayer，只要不移除他的logo即可免費使用，剛好最近有這個需求，就拿來用看看~感覺還不錯，不過檔案格式的支援好像沒有JW Player那麼完整，像是audio要用外掛可以播放，下面是結合了BlockUI的運用(因為有版面限制又不想換頁)


1
2
3
&#60;!-- 先載入Flowplayer及BlockUI --&#62;
&#60;script language=&#34;javascript&#34; src=&#34;flowplayer/flowplayer-3.1.4.min.js&#34;&#62;&#60;/script&#62;
&#60;script language=&#34;javascript&#34; src=&#34;jquery.blockUI.js&#34;&#62;&#60;/script&#62;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 傳入參為檔案路徑，例如：&#60;a href=&#34;javascript:play('/archive/flash.flv');&#34;&#62;播放&#60;/a&#62;
function play&#40;file_path&#41; &#123;
    // 設定blockUI的內容
    var html =  '&#60;a href=&#34;'+file_path+'&#34; style=&#34;display:block;width:425px;height:300px;&#34; id=&#34;player&#34;&#62;&#60;/a&#62;' + 
                '&#60;div style=&#34;text-align: center;&#34;&#62;&#60;br /&#62;' + 
  [...]]]></description>
			<content:encoded><![CDATA[<p>網站：<a href="http://flowplayer.org/" target="_blank">Flowplayer</a>、<a href="http://malsup.com/jquery/block/" target="_blank">BlockUI</a><br />
下載：<a href="http://releases.flowplayer.org/flowplayer/flowplayer-3.1.5.zip">Flowplayer 3.1.5.zip</a>、<a href="http://github.com/malsup/blockui/raw/master/jquery.blockUI.js?v2.31">BlockUI 2.31</a></p>
<p>之前使用的線上播放器是JW Player，但是他在某個版本開始(很久了)，限制非商業行為才能免費使用(應該不是我之前沒注意到吧@@)，之後發現了Flowplayer，只要不移除他的logo即可免費使用，剛好最近有這個需求，就拿來用看看~感覺還不錯，不過檔案格式的支援好像沒有JW Player那麼完整，像是audio要用外掛可以播放，下面是結合了BlockUI的運用(因為有版面限制又不想換頁)</p>
<p><span id="more-816"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> 先載入Flowplayer及BlockUI <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;flowplayer/flowplayer-3.1.4.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script language<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;jquery.blockUI.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// 傳入參為檔案路徑，例如：&lt;a href=&quot;javascript:play('/archive/flash.flv');&quot;&gt;播放&lt;/a&gt;</span>
<span style="color: #003366; font-weight: bold;">function</span> play<span style="color: #009900;">&#40;</span>file_path<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// 設定blockUI的內容</span>
    <span style="color: #003366; font-weight: bold;">var</span> html <span style="color: #339933;">=</span>  <span style="color: #3366CC;">'&lt;a href=&quot;'</span><span style="color: #339933;">+</span>file_path<span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; style=&quot;display:block;width:425px;height:300px;&quot; id=&quot;player&quot;&gt;&lt;/a&gt;'</span> <span style="color: #339933;">+</span> 
                <span style="color: #3366CC;">'&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;'</span> <span style="color: #339933;">+</span> 
                <span style="color: #3366CC;">'&lt;input type=&quot;button&quot; value=&quot;關閉&quot; onclick=&quot;$(<span style="color: #000099; font-weight: bold;">\'</span>#player<span style="color: #000099; font-weight: bold;">\'</span>).remove();$.unblockUI();&quot; /&gt;'</span> <span style="color: #339933;">+</span> 
                <span style="color: #3366CC;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// 產生blockUI</span>
    $.<span style="color: #660066;">blockUI</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        message<span style="color: #339933;">:</span> html<span style="color: #339933;">,</span>
        css<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> <span style="color: #3366CC;">'425px'</span><span style="color: #339933;">,</span> height<span style="color: #339933;">:</span><span style="color: #3366CC;">'300px'</span><span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #006600; font-style: italic;">// 建立Player</span>
    flowplayer<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;player&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;flowplayer/flowplayer-3.1.5.swf&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> 
        plugins<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> 
            <span style="color: #006600; font-style: italic;">// 加入audio的插件</span>
            audio<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> url<span style="color: #339933;">:</span> <span style="color: #3366CC;">'flowplayer/flowplayer.audio-3.1.2.swf'</span> <span style="color: #009900;">&#125;</span> 
        <span style="color: #009900;">&#125;</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>

]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2010/02/11/flowplayer-blockui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript dt = newDate()在IE要注意的不同</title>
		<link>http://blog.gclin.org/2010/02/09/javascript-dt-new_date-ie/</link>
		<comments>http://blog.gclin.org/2010/02/09/javascript-dt-new_date-ie/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 09:07:20 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[Date]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=805</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
8
9
10
// 當指定的時間無法轉為Date()時
// 除IE之外的瀏覽器是傳回NaN，而IE是回傳一個負數
var dt = new Date&#40;'ooxx'&#41;;
&#160;
if&#40;isNaN&#40;dt.getTime&#40;&#41;&#41; &#124;&#124; dt.getTime&#40;&#41; &#60; 0&#41; &#123;
    alert&#40;dt.getTime&#40;&#41;&#41;;
    dt = new Date&#40;&#41;;
&#125;
&#160;
alert&#40;dt.getTime&#40;&#41;&#41;;

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// 當指定的時間無法轉為Date()時</span>
<span style="color: #006600; font-style: italic;">// 除IE之外的瀏覽器是傳回NaN，而IE是回傳一個負數</span>
<span style="color: #003366; font-weight: bold;">var</span> dt <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ooxx'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isNaN<span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> dt.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    dt <span style="color: #339933;">=</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: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2010/02/09/javascript-dt-new_date-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Plugin Template</title>
		<link>http://blog.gclin.org/2009/12/27/jquery-plugin-template/</link>
		<comments>http://blog.gclin.org/2009/12/27/jquery-plugin-template/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 11:11:07 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=755</guid>
		<description><![CDATA[基本架構：

1
2
3
4
5
jQuery.fn.my_plugin = function&#40;&#41; &#123;
   return this.each&#40;function&#40;&#41; &#123;
       // TODO
   &#125;
&#125;

增強(方便)版 &#038; 範例：


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
jQuery.fn.my_plugin = function&#40;param&#41; &#123;
   // 這個this本身就是jQuery的物件了
   // 先放到$all這樣到了each裡面才能直接使用(裡面的this會指到別的物件)
   var $all = this;
&#160;
   // 自訂function給each裡的程式用(用this.避免與外部函式衝突)
   this.func = function&#40;str&#41; &#123;
      // [...]]]></description>
			<content:encoded><![CDATA[<p><strong>基本架構：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">my_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><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: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #006600; font-style: italic;">// TODO</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>增強(方便)版 &#038; 範例：</strong><br />
<span id="more-755"></span></p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">my_plugin</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>param<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #006600; font-style: italic;">// 這個this本身就是jQuery的物件了</span>
   <span style="color: #006600; font-style: italic;">// 先放到$all這樣到了each裡面才能直接使用(裡面的this會指到別的物件)</span>
   <span style="color: #003366; font-weight: bold;">var</span> $all <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #006600; font-style: italic;">// 自訂function給each裡的程式用(用this.避免與外部函式衝突)</span>
   <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">func</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// TODO</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #006600; font-style: italic;">// 把他轉成jQuery方便操做(這邊的this是HTML的Element)</span>
      <span style="color: #003366; font-weight: bold;">var</span> $this <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 取得目前處理的Element在$all的index</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>$all.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 用$all.呼叫my_plugin內定義的func</span>
      $all.<span style="color: #660066;">func</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 這邊可以直接存取到plugin帶進來的參數(param)</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span>param<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><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2009/12/27/jquery-plugin-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用jQuery UI的datepicker製作datetime選擇器</title>
		<link>http://blog.gclin.org/2009/12/18/jquery-ui-datepicker-datetime/</link>
		<comments>http://blog.gclin.org/2009/12/18/jquery-ui-datepicker-datetime/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 07:19:45 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[datepicker]]></category>
		<category><![CDATA[datetime]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=745</guid>
		<description><![CDATA[使用法方：

1
2
3
4
5
6
7
8
9
&#60;input type=&#34;hidden&#34; id=&#34;t1&#34; name=&#34;t1&#34; value=&#34;2009-01-01 00:00:00&#34; /&#62;
&#60;script language=&#34;javascript&#34;&#62;
$('#t1').datetime({
    dateFormat: &#34;yy-mm-dd&#34;,
    defaultDate: $(this).val(),
    changeMonth: true,
    changeYear: true,
});
&#60;/script&#62;

Plugin的程式碼：


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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
jQuery.fn.datetime = function&#40;param&#41; &#123;
   if&#40;typeof&#40;jQuery.fn.datepicker&#41; != 'function'&#41; &#123;
      alert&#40;'找不到datepicker'&#41;;
      return;
   &#125;
&#160;
   var [...]]]></description>
			<content:encoded><![CDATA[<p><strong>使用法方：</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;t1&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;t1&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;2009-01-01 00:00:00&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">language</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript&quot;</span>&gt;</span>
$('#t1').datetime({
    dateFormat: &quot;yy-mm-dd&quot;,
    defaultDate: $(this).val(),
    changeMonth: true,
    changeYear: true,
});
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></td></tr></table></div>

<p><strong>Plugin的程式碼：</strong><br />
<span id="more-745"></span></p>

<div class="wp_syntax"><table><tr><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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">datetime</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>param<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: #000066; font-weight: bold;">typeof</span><span style="color: #009900;">&#40;</span>jQuery.<span style="color: #660066;">fn</span>.<span style="color: #660066;">datepicker</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'找不到datepicker'</span><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>
&nbsp;
   <span style="color: #003366; font-weight: bold;">var</span> padLeft <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>str<span style="color: #339933;">,</span>lenght<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>str.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">length</span> <span style="color: #339933;">&gt;=</span> lenght<span style="color: #009900;">&#41;</span>  
         <span style="color: #000066; font-weight: bold;">return</span> str<span style="color: #339933;">;</span>  
      <span style="color: #000066; font-weight: bold;">else</span>  
         <span style="color: #000066; font-weight: bold;">return</span> padLeft<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;0&quot;</span> <span style="color: #339933;">+</span>str<span style="color: #339933;">,</span>lenght<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
   <span style="color: #009900;">&#125;</span>   
&nbsp;
   $all <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span>
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $this    <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $chk     <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;input type=&quot;checkbox&quot; id=&quot;chk_enable&quot;&gt; /'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $date    <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;input type=&quot;text&quot; id=&quot;'</span><span style="color: #339933;">+</span>id<span style="color: #339933;">+</span><span style="color: #3366CC;">'_d&quot; value=&quot;&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $hour    <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;select id=&quot;'</span><span style="color: #339933;">+</span>id<span style="color: #339933;">+</span><span style="color: #3366CC;">'_h&quot;&gt;&lt;/select&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>update<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> $minute  <span style="color: #339933;">=</span> jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;select id=&quot;'</span><span style="color: #339933;">+</span>id<span style="color: #339933;">+</span><span style="color: #3366CC;">'_m&quot;&gt;&lt;/select&gt;'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>update<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #003366; font-weight: bold;">var</span> id       <span style="color: #339933;">=</span> $this.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #003366; font-weight: bold;">var</span> dt       <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>$this.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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>isNaN<span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         $chk.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'checked'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $date.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $hour.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         $minute.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
         dt <span style="color: #339933;">=</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: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>$all.<span style="color: #660066;">index</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            dt.<span style="color: #660066;">setHours</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            dt.<span style="color: #660066;">setMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            dt.<span style="color: #660066;">setSeconds</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: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
            dt.<span style="color: #660066;">setHours</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">23</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            dt.<span style="color: #660066;">setMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">59</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            dt.<span style="color: #660066;">setSeconds</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">59</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         <span style="color: #009900;">&#125;</span>
         $chk.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>
            dt.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> 
            <span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #3366CC;">'-'</span> <span style="color: #339933;">+</span> 
            dt.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' '</span> <span style="color: #339933;">+</span> 
            dt.<span style="color: #660066;">toLocaleTimeString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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>
         $chk.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'checked'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'checked'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 更新的callback</span>
      <span style="color: #003366; font-weight: bold;">var</span> update   <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         $this.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>
            $date.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">' '</span> <span style="color: #339933;">+</span> 
            $hour.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">':'</span> <span style="color: #339933;">+</span> 
            $minute.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">':'</span> <span style="color: #339933;">+</span> 
            padLeft<span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getSeconds</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span>
         <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 啟用</span>
      $chk.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><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>$<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;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'checked'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            $date.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $hour.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $minute.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">!=</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               $this.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</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;">else</span> <span style="color: #009900;">&#123;</span>
            $date.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $hour.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $minute.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'disabled'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> $this.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            $this.<span style="color: #660066;">val</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: #009900;">&#125;</span>
      <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 日期</span>
      $date.<span style="color: #660066;">change</span><span style="color: #009900;">&#40;</span>update<span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">datepicker</span><span style="color: #009900;">&#40;</span>param<span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span>
             dt.<span style="color: #660066;">getFullYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'-'</span> <span style="color: #339933;">+</span> 
             <span style="color: #009900;">&#40;</span>dt.<span style="color: #660066;">getMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #3366CC;">'-'</span> <span style="color: #339933;">+</span> 
             dt.<span style="color: #660066;">getDate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
          .<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'width'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'80px'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 時</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> <span style="color: #CC0000;">24</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003366; font-weight: bold;">var</span> sel <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">==</span> dt.<span style="color: #660066;">getHours</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> sel <span style="color: #339933;">=</span> <span style="color: #3366CC;">' selected=&quot;selected&quot;'</span><span style="color: #339933;">;</span>
         $hour.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>
            <span style="color: #3366CC;">'&lt;option value=&quot;'</span><span style="color: #339933;">+</span>padLeft<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot;'</span><span style="color: #339933;">+</span>sel<span style="color: #339933;">+</span><span style="color: #3366CC;">'&gt;'</span> <span style="color: #339933;">+</span> 
            padLeft<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> 
            <span style="color: #3366CC;">'&lt;/option&gt;'</span>
         <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 分</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> <span style="color: #CC0000;">60</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #003366; font-weight: bold;">var</span> sel <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
         <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>i <span style="color: #339933;">==</span> dt.<span style="color: #660066;">getMinutes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> sel <span style="color: #339933;">=</span> <span style="color: #3366CC;">' selected=&quot;selected&quot;'</span><span style="color: #339933;">;</span>
         $minute.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>
            <span style="color: #3366CC;">'&lt;option value=&quot;'</span><span style="color: #339933;">+</span>padLeft<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;'</span> <span style="color: #339933;">+</span> sel <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&gt;'</span> <span style="color: #339933;">+</span> 
            padLeft<span style="color: #009900;">&#40;</span>i<span style="color: #339933;">,</span> <span style="color: #CC0000;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> 
            <span style="color: #3366CC;">'&lt;/option&gt;'</span>
         <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
&nbsp;
      <span style="color: #006600; font-style: italic;">// 加到表單內</span>
      $this.<span style="color: #660066;">parent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
           .<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$chk<span style="color: #009900;">&#41;</span>
           .<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$date<span style="color: #009900;">&#41;</span>
           .<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$hour<span style="color: #009900;">&#41;</span>
           .<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span>$minute<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><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2009/12/18/jquery-ui-datepicker-datetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Date Object</title>
		<link>http://blog.gclin.org/2009/12/17/javascript-date-object/</link>
		<comments>http://blog.gclin.org/2009/12/17/javascript-date-object/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 14:50:13 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[Date]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=738</guid>
		<description><![CDATA[JavaScript Date Object是一個用來處理日期及時間的物件
可由下列幾種方式建立：

1
2
3
4
5
6
7
8
9
10
11
12
// 取得目前的日期及時間
var d = new Date&#40;&#41;;
&#160;
// 指定時間
var d = new Date&#40;milliseconds&#41;;
var d = new Date&#40;dateString&#41;;
var d = new Date&#40;year, month, day, hours, minutes, seconds, milliseconds&#41;;
&#160;
// 判斷輸入時間是否正確
if&#40;isNaN&#40;d.getTime&#40;&#41;&#41;&#41; &#123;
    alert&#40;&#34;Invalid Date!&#34;&#41;;
&#125;

詳細用法請參考：JavaScript Date Object
]]></description>
			<content:encoded><![CDATA[<p>JavaScript Date Object是一個用來處理日期及時間的物件<br />
可由下列幾種方式建立：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// 取得目前的日期及時間</span>
<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</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: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// 指定時間</span>
<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>milliseconds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>dateString<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> d <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Date<span style="color: #009900;">&#40;</span>year<span style="color: #339933;">,</span> month<span style="color: #339933;">,</span> day<span style="color: #339933;">,</span> hours<span style="color: #339933;">,</span> minutes<span style="color: #339933;">,</span> seconds<span style="color: #339933;">,</span> milliseconds<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">// 判斷輸入時間是否正確</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isNaN<span style="color: #009900;">&#40;</span>d.<span style="color: #660066;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Invalid Date!&quot;</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://www.w3schools.com/jsref/jsref_obj_date.asp" target="_balnk">JavaScript Date Object</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2009/12/17/javascript-date-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我的創意idv.tw + Google Apps</title>
		<link>http://blog.gclin.org/2009/10/22/idv-tw-google-apps/</link>
		<comments>http://blog.gclin.org/2009/10/22/idv-tw-google-apps/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 05:41:47 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[idv.tw]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=704</guid>
		<description><![CDATA[Step 1. 查詢想要註冊的網域名稱是否已經有人註冊
進入http://www.showking.tw/，點擊 『我的創意idv.tw體驗活動』
在下面表單內輸入想要申請的名稱，按下送出之後只要沒有出現 『已有人申請，請重新選擇』即可往下一步進行

Step 2. 申請網域名稱
選擇下圖中其中一家廠商，點選後進入申請頁面

因為PCHome可以設定自管或代管比較方便，所以下面會以PCHome為例進行申請
申請頁面的網址為：http://myname.pchome.com.tw/act/freeidv.htm (輸入體驗序號)



接著填寫完個人資料即可進入管理DNS的介面
Step 3. 未完@@a
]]></description>
			<content:encoded><![CDATA[<p><strong>Step 1. 查詢想要註冊的網域名稱是否已經有人註冊</strong><br />
進入<a href="http://www.showking.tw/" target="_blank">http://www.showking.tw/</a>，點擊 『我的創意idv.tw體驗活動』<br />
在下面表單內輸入想要申請的名稱，按下送出之後只要沒有出現 『已有人申請，請重新選擇』即可往下一步進行<br />
<span id="more-704"></span><a href="http://blog.gclin.org/wp-content/uploads/2009/10/twnic1.jpg" target="_blank"><img src="http://blog.gclin.org/wp-content/uploads/2009/10/twnic1.jpg" alt="twnic1" title="twnic1" width="509" height="241" class="alignnone size-full wp-image-705" /></a></p>
<p><strong>Step 2. 申請網域名稱</strong><br />
選擇下圖中其中一家廠商，點選後進入申請頁面<br />
<a href="http://blog.gclin.org/wp-content/uploads/2009/10/twnic2.jpg" target="_blank"><img src="http://blog.gclin.org/wp-content/uploads/2009/10/twnic2.jpg" alt="twnic2" title="twnic2" width="509" height="159" class="alignnone size-full wp-image-712" /></a></p>
<p>因為PCHome可以設定自管或代管比較方便，所以下面會以PCHome為例進行申請<br />
申請頁面的網址為：<a href="http://myname.pchome.com.tw/act/freeidv.htm" target="_blank">http://myname.pchome.com.tw/act/freeidv.htm</a> (輸入體驗序號)<br />
<a href="http://blog.gclin.org/wp-content/uploads/2009/10/twnic3.jpg" target="_blank"><img src="http://blog.gclin.org/wp-content/uploads/2009/10/twnic3.jpg" alt="twnic3" title="twnic3" width="664" height="267" class="alignnone size-full wp-image-720" /></a><br />
<a href="http://blog.gclin.org/wp-content/uploads/2009/10/twnic4.jpg" target="_blank"><img src="http://blog.gclin.org/wp-content/uploads/2009/10/twnic4.jpg" alt="twnic4" title="twnic4" width="786" height="231" class="alignnone size-full wp-image-725" /></a><br />
<a href="http://blog.gclin.org/wp-content/uploads/2009/10/twnic5.jpg" target="_blank"><img src="http://blog.gclin.org/wp-content/uploads/2009/10/twnic5.jpg" alt="twnic5" title="twnic5" width="784" height="289" class="alignnone size-full wp-image-729" /></a><br />
接著填寫完個人資料即可進入管理DNS的介面</p>
<p><strong>Step 3. 未完@@a</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2009/10/22/idv-tw-google-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Maps路經規劃</title>
		<link>http://blog.gclin.org/2009/09/15/google-map-api-gdirections/</link>
		<comments>http://blog.gclin.org/2009/09/15/google-map-api-gdirections/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 17:15:18 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[未分類]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Google Maps]]></category>

		<guid isPermaLink="false">http://blog.gclin.org/?p=688</guid>
		<description><![CDATA[忙錄了好一陣子Blog也荒廢了好久了
Google Maps一直很想碰，但都沒有時間所以不太敢碰>』]]></description>
			<content:encoded><![CDATA[<p>忙錄了好一陣子Blog也荒廢了好久了<br />
Google Maps一直很想碰，但都沒有時間所以不太敢碰>』<<br />
結果剛好在ptt看到有人問Google Maps問題，就手癢了起來~~~<br />
還沒有時間仔細研究，這問題之後也可能會遇到，先來記一下</p>
<p>ptt.cc 文章代碼(AID): #1Agx_S0P (Ajax)</p>
<p>問題1：送出後無法正常顯示?<br />
解決：GDirections.load()的第二個參數是要用json來傳送</p>
<p>問題2：用完整地可以正常計算出路徑，但是只用"世新大學"跟"台北火車站"卻不行?<br />
解決：補上Taiwan就可以了，例："Taiwan 世新大學"跟"Taiwan 台北火車站"，或是直接讓程式自己補上</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> showAddress<span style="color: #009900;">&#40;</span>address1<span style="color: #339933;">,</span>address2<span style="color: #009900;">&#41;</span>  <span style="color: #009900;">&#123;</span>
    directions.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;from: Taiwan &quot;</span><span style="color: #339933;">+</span>address1<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; to: Taiwan &quot;</span><span style="color: #339933;">+</span>address2<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> <span style="color: #3366CC;">&quot;locale&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;zh_TW&quot;</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.gclin.org/gmap.php" target="_blank">http://blog.gclin.org/gmap.php</a></p>
<p>參考資料：<a href="http://code.google.com/intl/zh-TW/apis/maps/documentation/reference.html" target="_blank">Google Maps API Reference</a>、<a href="http://code.google.com/intl/zh-TW/apis/maps/documentation/reference.html#GDirections" target="_blank">GDirections</a>、<a href="http://code.google.com/intl/zh-TW/apis/maps/documentation/reference.html#GDirectionsOptions" target="_blank">GDirectionsOptions</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.gclin.org/2009/09/15/google-map-api-gdirections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
