<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>簡睿隨筆 《科技篇》-JavaScript</title>
<link>http://blog.roodo.com/emisjerry/archives/cat_324477.html</link>
<description>
  
    
      學習過程的各項紀錄與備忘
:::看不到圖請連我
的Xuite主站::
      
      
      
       
      
    
    
      





      
 

      

      
        
          
            
              
              輸
入您的搜尋字詞
              
            
          
        
        提
交搜尋表單
      
      
    
  





_uacct = &quot;UA-123122-2&quot;;
urchinTracker();

</description>
<language>zh-tw</language>
<generator>Roodo Blog System</generator>
<copyright>All Rights Reserved</copyright>
<atom:link href="http://blog.roodo.com/emisjerry/archives/cat_324477.xml" rel="self" type="application/rss+xml" />
<item>
	<title>幾個好用的FireFox Ubiquity命令：shorten、goto和screengrab</title>
	<description><![CDATA[
			介紹幾個好用的FireFox Ubiquity命令：shorten、goto和Screegrab。shorten以TinyURL.com、is.gd、bit.ly或hurl縮短網址，goto開啟網址或搜尋輸入的網址，screengrab則做網頁畫面的擷取（不須安裝附加元件），都是很方便的命令。
		]]>
	</description>
	<content:encoded><![CDATA[
			<p>介紹幾個好用的<a href="https://wiki.mozilla.org/Labs/Ubiquity" target="_blank">FireFox Ubiquity</a>命令：shorten、goto和Screegrab。shorten以<a href="http://tiny.com" target="_blank">TinyURL.com</a>、<em><a href="http://is.gd" target="_blank">is.gd</a></em>、<a href="http://bit.ly/" target="_blank">bit.ly</a>或<a href="http://www.hurl.ws" target="_blank">hurl</a>縮短網址，goto開啟網址或搜尋輸入的網址，screengrab則做網頁畫面的擷取（不須安裝附加元件），都是很方便的命令。</p>
		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/7445015.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/7445015.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/7445015.html</guid>
	<category>JavaScript</category>
	<pubDate>Sun, 26 Oct 2008 21:38:00 +0800</pubDate>
</item>
<item>
	<title>jQuery TreeView插件IE異常解決方法</title>
	<description><![CDATA[
			為了在網頁裡以樹狀方式讓使用者選取，於是使用了jQuery的TreeView插件，沒想到運行在IE展開節點時有一塊區域會隨機性清空，但在FireFox裡卻又正常。癥狀如下：Trace許久後終於解決了！沒想到竟然是註解標籤 &lt;!-- 、 --&gt; 造成問題。TreeView需要的&lt;ul&gt;、&lt;li&gt;結構是用Java程式由資料庫取出組成，為了方便偵錯而在&lt;/ul&gt;後面都再上註解標籤，結果在IE裡造成異常。拿掉這些註解標籤後就正常了。##
		]]>
	</description>
	<content:encoded><![CDATA[
			為了在網頁裡以樹狀方式讓使用者選取，於是使用了jQuery的<a href="http://bassistance.de/jquery-plugins/jquery-plugin-treeview/" target="_blank" title="外部連結至 http://bassistance.de/jquery-plugins/jquery-plugin-treeview/" class="externalLink">TreeView插件</a>，沒想到運行在IE展開節點時有一塊區域會隨機性清空，但在FireFox裡卻又正常。癥狀如下：<br /><img src="http://b.blog.xuite.net/b/3/a/c/11893557/blog_10351/txt/14371803/0.jpg" alt="" title="alt_text" /><br />Trace許久後終於解決了！沒想到竟然是註解標籤 &lt;!-- 、 --&gt; 造成問題。TreeView需要的&lt;ul&gt;、&lt;li&gt;結構是用Java程式由資料庫取出組成，為了方便偵錯而在&lt;/ul&gt;後面都再上註解標籤，結果在IE裡造成異常。拿掉這些註解標籤後就正常了。<br /><br />##
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4474495.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4474495.html</guid>
	<category>JavaScript</category>
	<pubDate>Tue, 13 Nov 2007 22:01:47 +0800</pubDate>
</item>
<item>
	<title>jQuery選擇器測試與範例</title>
	<description><![CDATA[
			為了熟悉jQuery選擇器的使用，特別寫了一個測試網頁，以下是功能備忘。在表單 FORM1 裡放入姓名、住址、電話等資料項目，項目形式有Text、Button、Select、TextArea等多種，再用幾個功能按鈕執行不同的過濾字串，最後把符合的項目ID顯示在網頁下方。 項目要放在一個有序清單(Ordered List, ol)裡，因此用 $(&quot;&lt;ol&gt;&lt;/ol&gt;&quot;) 建立新的要素(等同於 document.createElement(&quot;ol&quot;) 。為方便後續操作使用此要素，將之存入變數$result。 jQuery的命名慣例：jQuery的物件變數都以 $ 符號開頭，如上例中的$result就是一個jQuery物件。 清除jQuery物件的內容可使用remove() method，$result.remove( )，在執行操作前要把$result內容先清空，否則會讓清單越加越長。 $result.append(&quot;HTML內容&quot;)會把字串附加到$result裡面。 針對表單FORM1操作的選擇器寫法：序操作功能選擇器說明1找出所有項目$(&quot;#FORM1 :input&quot;)包含input、select、textarea、button等2找出type='text'的項目$(&quot;#FORM1 :text&quot;) | | | 3 |找出type='hidden'的項目 |{{{$(&quot;#FORM1 input[@type='hidden']&quot;):hidden是被隱藏的項目而不是Hidden類型的&lt;input&gt;項目，因此必須用指定屬性的寫法4列出type='hidden'且有title屬性之項目$(&quot;#FORM1 input[@type='hidden'][@title]&quot;) 兩個條件都成立的項目才會被選到5ID有2之項目$(&quot;FORM1 input[@id*='2']&quot;)開頭^、結尾$、含有*，這幾個符號和正規運算式相同，很好記憶6ID以DUM開頭之項目$(&quot;FORM1 input[@id^='DUM']&quot;&nbsp;完整的程式請參考，檢視原始檔即可： http://emisjerry.googlepages.com/selector1.html ##
		]]>
	</description>
	<content:encoded><![CDATA[
			為了熟悉jQuery選擇器的使用，特別寫了一個<a href="http://emisjerry.googlepages.com/selector1.html" target="_blank" title="外部連結至 http://emisjerry.googlepages.com/selector1.html" class="externalLink">測試網頁</a>，以下是功能備忘。<br /><br />在表單 FORM1 裡放入姓名、住址、電話等資料項目，項目形式有<strong>Text</strong>、<strong>Button</strong>、<strong>Select</strong>、<strong>TextArea</strong>等多種，再用幾個功能按鈕執行不同的過濾字串，最後把符合的項目ID顯示在網頁下方。<br /><ol><li> 項目要放在一個有序清單(Ordered List, ol)裡，因此用 $(&quot;&lt;ol&gt;&lt;/ol&gt;&quot;) 建立新的要素(等同於 document.createElement(&quot;ol&quot;) 。為方便後續操作使用此要素，將之存入變數$result。<ul><li> jQuery的命名慣例：jQuery的物件變數都以<strong> $ </strong>符號開頭，如上例中的$result就是一個jQuery物件。</li></ul></li><li> 清除jQuery物件的內容可使用remove() method，$result.remove( )，在執行操作前要把$result內容先清空，否則會讓清單越加越長。</li><li> $result.append(&quot;HTML內容&quot;)會把字串附加到$result裡面。</li><li> 針對表單FORM1操作的選擇器寫法：</li></ol><table border="0" class="twtable"><thead><tr class="evenRow"><td align="center">序</td><td align="center">操作功能</td><td align="center">選擇器</td><td align="center">說明</td></tr></thead><tbody><tr class="oddRow"><td align="center">1</td><td align="left">找出所有項目</td><td align="left">$(&quot;#FORM1 :input&quot;)</td><td align="left">包含input、select、textarea、button等</td></tr><tr class="evenRow"><td align="center">2</td><td align="left">找出type='text'的項目</td><td align="left">$(&quot;#FORM1 :text&quot;) | | | 3 |找出type='hidden'的項目 |{{{$(&quot;#FORM1 input[@type='hidden']&quot;)</td><td align="left">:hidden是被隱藏的項目而不是Hidden類型的&lt;input&gt;項目，因此必須用指定屬性的寫法</td></tr><tr class="oddRow"><td align="center">4</td><td align="left">列出type='hidden'且有title屬性之項目</td><td align="left">$(&quot;#FORM1 input[@type='hidden'][@title]&quot;) </td><td align="left">兩個條件都成立的項目才會被選到</td></tr><tr class="evenRow"><td align="center">5</td><td align="left">ID有2之項目</td><td align="left">$(&quot;FORM1 input[@id*='2']&quot;)</td><td align="left">開頭^、結尾$、含有*，這幾個符號和正規運算式相同，很好記憶</td></tr><tr class="oddRow"><td align="center">6</td><td align="left">ID以DUM開頭之項目</td><td align="left">$(&quot;FORM1 input[@id^='DUM']&quot;</td><td align="right">&nbsp;</td></tr></tbody></table><br />完整的程式請參考，檢視原始檔即可：<br /><ul><li> <a href="http://emisjerry.googlepages.com/selector1.html" target="_blank" title="外部連結至 http://emisjerry.googlepages.com/selector1.html" class="externalLink">http://emisjerry.googlepages.com/selector1.html</a></li></ul><iframe width="100%" height="300" frameborder="0" scrolling="yes" src="http://220.134.115.15/blogs/jquery.html"></iframe> ##
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4211415.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4211415.html</guid>
	<category>JavaScript</category>
	<pubDate>Sat, 29 Sep 2007 23:22:36 +0800</pubDate>
</item>
<item>
	<title>jQuery神奇的選擇器(Selector)</title>
	<description><![CDATA[
			 就像正規運 算式(Regular Expression)的Pattern match一般，jQuery使用了CSS(Cascading Style Sheet)、XPath(XML Path Language)與自訂等三大類的選擇器(Selector)當做$( )函數的參數，讓我們由複雜多樣的DOM結構裡，快速的找出符合樣式的要素。  使用選擇器的三個基本格式是：   序 格式 範例 說明    1 $(&quot;HTML標籤&quot;) $(&quot;div&quot;) 傳回表示所有div要素的jQuery物件   2 $(&quot;#要素的ID&quot;) $(&quot;#linksLeft&quot;) 傳回表示&lt;div id=&quot;linksLeft&quot;&gt;要素的jQuery物件   3 $(&quot;.要素的類別&quot;) $(&quot;.blogname&quot;) 傳回&lt;div class=&quot;blogname&quot;&gt;要素的jQuery物件     CSS選擇器 更完整的CSS Selector如下表：   樣 式 說明 範例    * 萬用選擇器(Universal selector)；表示所有的要素 $(&quot;*&quot;)   E Type selectors；選取指定的要素類型 $(&quot;div&quot;) 選取所有的div要素   E &gt; F Child selectors；選取E的子要素F $(&quot;div &gt; li&quot;) 選取div要素裡的子要素li   E F Descendant selectors；選取E的後代要素F，子代、孫代、... $(&quot;div li&quot;)   E + F 套用緊鄰在E之後的要素F 範例在表格下面   E:first-child E是第一個子要素；這個表示方法似乎不是很直覺，容易被理解成是E的第一個子要素，但其實是：E是其父要素的第一個子要 素 $(&quot;.blogbody:first-child&quot;) 找到首頁第一篇文章   E:last-child E是其父要素的最後一個子要素 $(&quot;.blogbody:last-child&quot;) 找到首頁最後一篇文章   E:nth-child(n) E是其父要素的第n個子要素 $(&quot;.blogbody:nth-child(2)&quot;) 找到首頁第３篇文章(由0起算)   E:only-child E是唯一的子要素 $(&quot;.blogname:only-child&quot;)   E:empty E沒有任何的子要素 $(&quot;div:empty&quot;)   E:enabled 生效的要素E HTML標籤沒有被加上disabled   E:disabled 失效的要素E HTML標籤被加上disabled   E:checked 被勾選的要素E HTML標籤被加上chedked   E:selected 被選取的要素E HTML標籤被加上selected   E:not(s) 不屬於s的要素E $(&quot;.blogbody:not(blogbody_even)   E[@attr] 有指定屬性的要素E $(&quot;a[@href]) 找出所有的&lt;a href=&quot;...&quot;&gt;&quot;)   E[@attr=value] 屬性的值完全相同的要素E $(&quot;h3[@class=hdr]&quot;)   E[@attr^=value] 屬性的值以value開頭的要素E $(&quot;a[@href^=http://blog.xuite.net]&quot;)   E[@attr$=value] 屬性的值以value結尾的要素E $(&quot;a[@href$=.pdf]&quot;)   E[@attr*=value] 屬性的值含有value的要素E $(&quot;a[@href*=xuite.net]&quot;)   E[@attr1=value1] [@attr2=value2 選取條件同時成立的要素E     E + F 範例：  h2 + * { color:green } /*所有緊隨 h2 的要素内的文字皆為紅色 */ h1 + p { border-top: 3px solid #f60; }  HTML原始碼(標題會套用h1 + p)： &lt;h1&gt;標題&lt;/h1&gt;&lt;p&gt;段落 A&lt;/p&gt;&lt;p&gt;段落 B&lt;/p&gt;&lt;p&gt;段落 C&lt;/p&gt; 自訂的選擇器   樣 式 說明 範例    :even 要素的偶數項 $(&quot;tbody tr:even&quot;).addClass(&quot;even&quot;)   :odd 要素的奇數項 $(&quot;tbody tr:odd&quot;).addClass(&quot;odd&quot;)   :eq(N) 第N項的要素 $(&quot;div.blogbody:eq(0)&quot;) 選第一篇文章   :gt(N) 大於第N項的要素 $(&quot;div.blogbody:gt(3)&quot;) 選第五篇(由0起算)~第十篇的文章(假設首頁只有十篇)   :lt(N) 小於第N項的要素 $(&quot;div.blogbody:lt(3)&quot;) 選第一篇至第三篇文章   :first 等於:eq(0)，第一個要素 $(&quot;div.blogbody:first') 選第一篇文章   :last 最後的要素 $(&quot;div.blogbody:last&quot;) 第十篇文章   :parent 選取自己是父代的要素 $(&quot;div.blogbody:parent&quot;) 有子要素的文章會被選取   :contains(&quot;text&quot;) 選取含有指定文字的要素 $(&quot;div.title:contains('jQuery')&quot;) 找出有jQuery字串的標題   :visible 有呈現出的要素 &nbsp;   :hidden 隱藏了的要素 &nbsp;    表單的選擇器   樣 式 說明 範例    :input 選取所有的輸入要素，包含input、select、textara、 button等 $(&quot;#form1 :input&quot;)   :text 選取&lt;input type=&quot;text&quot;&gt;的要素 &nbsp;   :password 選取&lt;input type=&quot;password&quot;&gt;的要素 &nbsp;   :radio 選取&lt;input type=&quot;radio&quot;&gt;的要素 &nbsp;   :checkbox 選取&lt;input type=&quot;checkbox&quot;&gt;的要素 &nbsp;   :submit 選取&lt;input type=&quot;submit&quot;&gt;的要素 &nbsp;   :image 選取&lt;input type=&quot;image&quot;&gt;的要素 &nbsp;   :reset 選取&lt;input type=&quot;reset&quot;&gt;的要素 &nbsp;   :button 選取&lt;input type=&quot;button&quot;&gt;的要素 &nbsp;   :reset 選取&lt;input type=&quot;reset&quot;&gt;的要素 &nbsp;   :file 選取&lt;input type=&quot;file&quot;&gt;的要素 &nbsp;     表單和選擇器之間至少要空一格，如: $(&quot;#fom1 :button&quot;)會生效，$(&quot;#form1:button&quot;)則無法運作參考：http://docs.jquery.com/DOM/Traversing/Selectors#CSS_Selectors    
		]]>
	</description>
	<content:encoded><![CDATA[
			 <div class="viewer">就像正規運 算式(Regular Expression)的Pattern match一般，jQuery使用了CSS(Cascading Style Sheet)、XPath(XML Path Language)與自訂等三大類的選擇器(Selector)當做$( )函數的參數，讓我們由複雜多樣的DOM結構裡，快速的找出符合樣式的要素。<br /> <br /> 使用選擇器的三個基本格式是：<br /> <table border="0" class="twtable"> <thead><tr class="evenRow"> <td align="center">序</td> <td align="center">格式</td> <td align="center">範例</td> <td align="center">說明</td> </tr> </thead><tbody> <tr class="oddRow"> <td align="center">1</td> <td align="left">$(&quot;HTML標籤&quot;)</td> <td align="left">$(&quot;div&quot;)</td> <td align="left">傳回表示所有div要素的jQuery物件</td> </tr> <tr class="evenRow"> <td align="center">2</td> <td align="left">$(&quot;#要素的ID&quot;)</td> <td align="center">$(&quot;#linksLeft&quot;)</td> <td align="left">傳回表示&lt;div id=&quot;linksLeft&quot;&gt;要素的jQuery物件</td> </tr> <tr class="oddRow"> <td align="center">3</td> <td align="left">$(&quot;.要素的類別&quot;)</td> <td align="left">$(&quot;.blogname&quot;)</td> <td align="left">傳回&lt;div class=&quot;blogname&quot;&gt;要素的jQuery物件</td> </tr> </tbody> </table> <h3> CSS選擇器</h3> 更完整的CSS Selector如下表：<br /> <table border="0" class="twtable"> <thead><tr class="evenRow"> <td align="center">樣 式</td> <td align="center">說明</td> <td align="center">範例</td> </tr> </thead><tbody> <tr class="oddRow"> <td align="center">*</td> <td align="left">萬用選擇器(Universal selector)；表示所有的要素</td> <td align="left">$(&quot;*&quot;)</td> </tr> <tr class="evenRow"> <td align="left">E</td> <td align="left">Type selectors；選取指定的要素類型</td> <td align="left">$(&quot;div&quot;) 選取所有的div要素</td> </tr> <tr class="oddRow"> <td align="left">E &gt; F</td> <td align="left">Child selectors；選取E的子要素F</td> <td align="left">$(&quot;div &gt; li&quot;) 選取div要素裡的子要素li</td> </tr> <tr class="evenRow"> <td align="left">E F</td> <td align="left">Descendant selectors；選取E的後代要素F，子代、孫代、...</td> <td align="left">$(&quot;div li&quot;)</td> </tr> <tr class="oddRow"> <td>E + F</td> <td>套用緊鄰在E之後的要素F</td> <td align="left">範例在表格下面</td> </tr> <tr class="evenRow"> <td align="left">E:first-child</td> <td>E是第一個子要素；這個表示方法似乎不是很直覺，容易被理解成是E的第一個子要素，但其實是：E是其父要素的第一個子要 素</td> <td>$(&quot;.<span class="externalLink">blogbody:first-child</span>&quot;) 找到首頁第一篇文章</td> </tr> <tr class="oddRow"> <td>E:last-child</td> <td>E是其父要素的最後一個子要素</td> <td>$(&quot;.<span class="externalLink">blogbody:last-child</span>&quot;) 找到首頁最後一篇文章</td> </tr> <tr class="evenRow"> <td>E:nth-child(n)</td> <td>E是其父要素的第n個子要素</td> <td>$(&quot;.<span class="externalLink">blogbody:nth-child(2</span>)&quot;) 找到首頁第３篇文章(由0起算)</td> </tr> <tr class="oddRow"> <td>E:only-child</td> <td>E是唯一的子要素</td> <td>$(&quot;.<span class="externalLink">blogname:only-child</span>&quot;)</td> </tr> <tr class="evenRow"> <td align="left">E:empty</td> <td align="left">E沒有任何的子要素</td> <td align="left">$(&quot;<span class="externalLink">div:empty</span>&quot;)</td> </tr> <tr class="oddRow"> <td>E:enabled</td> <td align="left">生效的要素E</td> <td align="left">HTML標籤沒有被加上disabled</td> </tr> <tr class="evenRow"> <td>E:disabled</td> <td align="left">失效的要素E</td> <td align="left">HTML標籤被加上disabled</td> </tr> <tr class="oddRow"> <td>E:checked</td> <td>被勾選的要素E</td> <td align="left">HTML標籤被加上chedked</td> </tr> <tr class="evenRow"> <td>E:selected</td> <td>被選取的要素E</td> <td align="left">HTML標籤被加上selected</td> </tr> <tr class="oddRow"> <td>E:not(s)</td> <td align="left">不屬於s的要素E</td> <td align="left">$(&quot;.<span class="externalLink">blogbody:not(blogbody_even</span>)</td> </tr> <tr class="evenRow"> <td align="left">E[@attr]</td> <td align="left">有指定屬性的要素E</td> <td align="left">$(&quot;a[@href]) 找出所有的&lt;a href=&quot;...&quot;&gt;&quot;)</td> </tr> <tr class="oddRow"> <td align="left">E[@attr=value]</td> <td align="left">屬性的值完全相同的要素E</td> <td align="left">$(&quot;h3[@class=hdr]&quot;)</td> </tr> <tr class="evenRow"> <td>E[@attr^=value]</td> <td align="left">屬性的值以value開頭的要素E</td> <td align="left">$(&quot;a[@href^=<span class="externalLink">http://blog.xuite.net]</span>&quot;)</td> </tr> <tr class="oddRow"> <td>E[@attr$=value]</td> <td align="left">屬性的值以value結尾的要素E</td> <td align="left">$(&quot;a[@href$=.pdf]&quot;)</td> </tr> <tr class="evenRow"> <td>E[@attr*=value]</td> <td align="left">屬性的值含有value的要素E</td> <td align="left">$(&quot;a[@href*=xuite.net]&quot;)</td> </tr> <tr class="oddRow"> <td>E[@attr1=value1]<span><br /> </span>[@attr2=value2</td> <td align="left">選取條件同時成立的要素E</td> </tr> </tbody> </table> <ul><li> E + F 範例：</li></ul> <pre> h2 + * { color:green } /*所有緊隨 h2 的要素内的文字皆為紅色 */<br /> h1 + p { border-top: 3px solid #f60; }<br /></pre> <ul><li> HTML原始碼(標題會套用h1 + p)：</li></ul> <pre>&lt;h1&gt;標題&lt;/h1&gt;<br />&lt;p&gt;段落 A&lt;/p&gt;<br />&lt;p&gt;段落 B&lt;/p&gt;<br />&lt;p&gt;段落 C&lt;/p&gt;<br /></pre> <h3>自訂的選擇器</h3> <table border="0" class="twtable"> <thead><tr class="evenRow"> <td align="center">樣 式</td> <td align="center">說明</td> <td align="center">範例</td> </tr> </thead><tbody> <tr class="oddRow"> <td align="left">:even</td> <td align="left">要素的偶數項</td> <td align="left">$(&quot;tbody tr:even&quot;).addClass(&quot;even&quot;)</td> </tr> <tr class="evenRow"> <td align="left">:odd</td> <td align="left">要素的奇數項</td> <td align="left">$(&quot;tbody tr:odd&quot;).addClass(&quot;odd&quot;)</td> </tr> <tr class="oddRow"> <td align="left">:eq(N)</td> <td align="left">第N項的要素</td> <td align="left">$(&quot;div.<span class="externalLink">blogbody:eq(0</span>)&quot;) 選第一篇文章</td> </tr> <tr class="evenRow"> <td align="left">:gt(N)</td> <td align="left">大於第N項的要素</td> <td align="left">$(&quot;div.<span class="externalLink">blogbody:gt(3</span>)&quot;) 選第五篇(由0起算)~第十篇的文章(假設首頁只有十篇)</td> </tr> <tr class="oddRow"> <td align="left">:lt(N)</td> <td align="left">小於第N項的要素</td> <td align="left">$(&quot;div.<span class="externalLink">blogbody:lt(3</span>)&quot;) 選第一篇至第三篇文章</td> </tr> <tr class="evenRow"> <td align="left">:first</td> <td align="left">等於:eq(0)，第一個要素</td> <td align="left">$(&quot;div.<span class="externalLink">blogbody:first</span>') 選第一篇文章</td> </tr> <tr class="oddRow"> <td align="left">:last</td> <td align="left">最後的要素</td> <td align="left">$(&quot;div.<span class="externalLink">blogbody:last</span>&quot;) 第十篇文章</td> </tr> <tr class="evenRow"> <td align="left">:parent</td> <td align="left">選取自己是父代的要素</td> <td>$(&quot;div.<span class="externalLink">blogbody:parent</span>&quot;) 有子要素的文章會被選取</td> </tr> <tr class="oddRow"> <td align="left">:contains(&quot;text&quot;)</td> <td align="left">選取含有指定文字的要素</td> <td align="left">$(&quot;div.<span class="externalLink">title:contains</span>('jQuery')&quot;) 找出有jQuery字串的標題</td> </tr> <tr class="evenRow"> <td align="left">:visible</td> <td align="left">有呈現出的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:hidden</td> <td align="left">隱藏了的要素</td> <td align="right">&nbsp;</td> </tr> </tbody> </table> <h3>表單的選擇器</h3> <table border="0" class="twtable"> <thead><tr class="evenRow"> <td align="center">樣 式</td> <td align="center">說明</td> <td align="center">範例</td> </tr> </thead><tbody> <tr class="oddRow"> <td align="left">:input</td> <td align="left">選取所有的輸入要素，包含input、select、textara、 button等</td> <td align="left">$(&quot;#form1 :input&quot;)</td> </tr> <tr class="evenRow"> <td align="left">:text</td> <td align="left">選取&lt;input type=&quot;text&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:password</td> <td align="left">選取&lt;input type=&quot;password&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="evenRow"> <td align="left">:radio</td> <td align="left">選取&lt;input type=&quot;radio&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:checkbox</td> <td align="left">選取&lt;input type=&quot;checkbox&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="evenRow"> <td align="left">:submit</td> <td align="left">選取&lt;input type=&quot;submit&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:image</td> <td align="left">選取&lt;input type=&quot;image&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="evenRow"> <td align="left">:reset</td> <td align="left">選取&lt;input type=&quot;reset&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:button</td> <td align="left">選取&lt;input type=&quot;button&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="evenRow"> <td align="left">:reset</td> <td align="left">選取&lt;input type=&quot;reset&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> <tr class="oddRow"> <td align="left">:file</td> <td align="left">選取&lt;input type=&quot;file&quot;&gt;的要素</td> <td align="right">&nbsp;</td> </tr> </tbody> </table> <ul><li> 表單和選擇器之間至少要空一格，如: $(&quot;#fom1 :button&quot;)會生效，$(&quot;#form1:button&quot;)則無法運作</li></ul>參考：<a href="http://docs.jquery.com/DOM/Traversing/Selectors#CSS_Selectors" target="_blank">http://docs.jquery.com/DOM/Traversing/Selectors#CSS_Selectors</a> </div>  <iframe width="100%" height="400" frameborder="0" scrolling="yes" src="http://220.134.115.15/blogs/jquery.html"></iframe> 
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4205285.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4205285.html</guid>
	<category>JavaScript</category>
	<pubDate>Sat, 29 Sep 2007 00:09:09 +0800</pubDate>
</item>
<item>
	<title>方便查閱的jQuery 1.2 Cheat Sheet</title>
	<description><![CDATA[
			如果你也在學習jQuery的話，Richard Augus整理了一個jQuery彙總表(Cheat Sheet)，對於查閱相當方便；現有PDF和PNG兩個版本。
		]]>
	</description>
	<content:encoded><![CDATA[
			如果你也在學習jQuery的話，Richard Augus整理了一個<a href="http://labs.colorcharge.com/jquery/" target="_blank">jQuery彙總表</a>(Cheat Sheet)，對於查閱相當方便；現有PDF和PNG兩個版本。
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4191713.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4191713.html</guid>
	<category>JavaScript</category>
	<pubDate>Tue, 25 Sep 2007 23:15:30 +0800</pubDate>
</item>
<item>
	<title>使用jQuery的效益</title>
	<description><![CDATA[
			jQuery是個輕量級的JavaScript程式庫，輕量級的意思是它的程式庫極其精簡且很容易的能被使用，整合到現有程式裡也很簡便：只要在網頁程式&lt;head&gt;區加入&lt;script src=&quot;/js存放路徑/jquery.js&quot;&gt;&lt;/script&gt;即可，而因應不同的環境，jquery.js檔案有幾種不同的格式可供使用：js檔名檔案大小用途jquery-1.2.1.js78.6KB使用於開發環境jquery-1.2.1-pack.js27KB使用Packer壓縮過的檔案，適用於正式運行環境；Xuite內使用的就是pack格式的檔案jquery-1.2.1-min.js45.3KB適用於正式運行環境; 似乎Server要搭配GZip才能達到更小的檔案大小和傳統的JavaScript寫法相比，我覺得使用jQuery有幾個效益：大幅簡化存取DOM的要素的寫法；我們以取得Xuite的部落格名稱做範例 Xuite的部落格名稱並未指定ID，而是用class來定義：&lt;div class=&quot;blogname&quot;&gt;  &lt;a href=&quot;/emisjerry/tech&quot;&gt;簡睿隨筆 《科技篇》&lt;/a&gt;  &lt;span class=&quot;blogemotion&quot;&gt;&lt;/span&gt;  &lt;span class=&quot;blogfavo&quot;&gt;&lt;/span&gt;&lt;/div&gt;&nbsp; 如果有指定ID的要素，可以直接用document.getElementById(ID)就取到，但在沒有ID的狀況下就必須用document.getElementsByTagName(&quot;div&quot;)先找出所有的div標籤，再用迴圈比對className，才能找到&lt;div class=&quot;blogname&quot;&gt;，即使把這些動作整理成一個函數來處理，也是頗為麻煩。 而jQuery只要用CSS或XPath的語法很容易就能取到代表&lt;div class=&quot;blogname&quot;&gt;的jQuery物件： $(&quot;.blogname&quot;)  $( )是jQuery的函數，會回傳jQuery物件，透過此物件的諸多method，就能很輕易的存取DOM要素。例如用$(&quot;.blogname&quot;).children()可取出&lt;div class=&quot;blogname&quot;&gt;裡的子要素 CSS的類別放在StyleSheet的檔案裡是用點(.)開頭，ID是以井號(#)開頭，jQuery裡也是使用相同的寫法，例如用&quot;.blogname&quot;表示類別blogname，$(&quot;#linksLeft&quot;)則存取ID為linksLeft的要素：&lt;div id=&quot;linksLeft&quot;&gt; 簡化網頁特效的寫法；jQuery提供了許多特效method，例如toggle() (要素的顯示/隱藏切換)、slideToggle() (滑動式顯示/隱藏切換)等等 簡化要素事件的寫法 一般的寫法比較繁複一些：  document.getElementById(&quot;linksLeft&quot;).onclick = function() {    alert(&quot;左邊Panel clicked!&quot;);  }&nbsp; jQuery的寫法：  $(&quot;linksLeft&quot;).click(function() {    alert(&quot;左邊Panel clicked!&quot;);    });&nbsp;&nbsp; 驅動事件的onXXXX的on不必寫，把要處理的程式用匿名函數傳入 簡化AJAX的處理寫法：這是原本使用jQuery的最主要原因，要自行處理AJAX的所有細節有點太浪費生命了，還是使用Open source的程式庫較好  
		]]>
	</description>
	<content:encoded><![CDATA[
			<div class="viewer"><a href="http://jquery.com/" target="_blank" title="外部連結至 http://jquery.com" class="externalLink">jQuery</a>是個輕量級的JavaScript程式庫，輕量級的意思是它的程式庫極其精簡且很容易的能被使用，整合到現有程式裡也很簡便：只要在網頁程式&lt;head&gt;區加入&lt;script src=&quot;/js存放路徑/jquery.js&quot;&gt;&lt;/script&gt;即可，而因應不同的環境，jquery.js檔案有幾種不同的格式可供使用：<br /><table border="0" class="twtable"><tbody><tr class="evenRow"><td align="center">js檔名</td><td align="center">檔案大小</td><td align="center">用途</td></tr><tr class="oddRow"><td align="left"><a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.js" target="_blank" title="外部連結至 http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.js" class="externalLink">jquery-1.2.1.js</a></td><td align="right">78.6KB</td><td>使用於開發環境</td></tr><tr class="evenRow"><td align="left"><a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.pack.js" target="_blank" title="外部連結至 http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.pack.js" class="externalLink">jquery-1.2.1-pack.js</a></td><td align="right">27KB</td><td>使用<a href="http://dean.edwards.name/packer/" target="_blank" title="外部連結至 http://dean.edwards.name/packer/" class="externalLink">Packer</a>壓縮過的檔案，適用於正式運行環境；Xuite內使用的就是pack格式的檔案</td></tr><tr class="oddRow"><td align="left"><a href="http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.min.js" target="_blank" title="外部連結至 http://code.google.com/p/jqueryjs/downloads/detail?name=jquery-1.2.1.min.js" class="externalLink">jquery-1.2.1-min.js</a></td><td align="right">45.3KB</td><td>適用於正式運行環境; 似乎Server要搭配<a href="javascript:;" title="'GZip' 尚無內容" class="tiddlyLink tiddlyLinkNonExisting">GZip</a>才能達到更小的檔案大小</td></tr></tbody></table><br />和傳統的<a href="javascript:;" title="JavaScript - YourName, 2007年9月5日 14:21:00" class="tiddlyLink tiddlyLinkExisting">JavaScript</a>寫法相比，我覺得使用jQuery有幾個效益：<br /><ul><li>大幅簡化存取DOM的要素的寫法；我們以取得Xuite的部落格名稱做範例<ul><li> Xuite的部落格名稱並未指定ID，而是用class來定義：</li></ul></li></ul><pre>&lt;div class=&quot;blogname&quot;&gt;<br />  &lt;a href=&quot;/emisjerry/tech&quot;&gt;簡睿隨筆 《科技篇》&lt;/a&gt;<br />  &lt;span class=&quot;blogemotion&quot;&gt;&lt;/span&gt;<br />  &lt;span class=&quot;blogfavo&quot;&gt;&lt;/span&gt;<br />&lt;/div&gt;<br /></pre><ul><li>&nbsp;<ul><li> 如果有指定ID的要素，可以直接用document.getElementById(ID)就取到，但在沒有ID的狀況下就必須用document.getElementsByTagName(&quot;div&quot;)先找出所有的div標籤，再用迴圈比對className，才能找到&lt;div class=&quot;blogname&quot;&gt;，即使把這些動作整理成一個函數來處理，也是頗為麻煩。</li><li> 而jQuery只要用CSS或XPath的語法很容易就能取到代表&lt;div class=&quot;blogname&quot;&gt;的jQuery物件： $(&quot;.blogname&quot;) <ul><li> $( )是jQuery的函數，會回傳jQuery物件，透過此物件的諸多method，就能很輕易的存取DOM要素。例如用$(&quot;.blogname&quot;).children()可取出&lt;div class=&quot;blogname&quot;&gt;裡的子要素</li><li> CSS的類別放在StyleSheet的檔案裡是用點(.)開頭，ID是以井號(#)開頭，jQuery裡也是使用相同的寫法，例如用&quot;.blogname&quot;表示類別blogname，$(&quot;#linksLeft&quot;)則存取ID為linksLeft的要素：&lt;div id=&quot;linksLeft&quot;&gt;</li></ul></li></ul></li><li> 簡化網頁特效的寫法；jQuery提供了許多特效method，例如toggle() (要素的顯示/隱藏切換)、slideToggle() (滑動式顯示/隱藏切換)等等</li><li> 簡化要素事件的寫法<ul><li> 一般的寫法比較繁複一些：</li></ul></li></ul><pre>  document.getElementById(&quot;linksLeft&quot;).onclick = function() {<br />    alert(&quot;左邊Panel clicked!&quot;);<br />  }<br /></pre><ul><li>&nbsp;<ul><li> jQuery的寫法：</li></ul></li></ul><pre>  $(&quot;linksLeft&quot;).click(function() {<br />    alert(&quot;左邊Panel clicked!&quot;);  <br />  });<br /></pre><ul><li>&nbsp;<ul><li>&nbsp;<ul><li> 驅動事件的onXXXX的on不必寫，把要處理的程式用匿名函數傳入</li></ul></li></ul></li><li> 簡化AJAX的處理寫法：這是原本使用jQuery的最主要原因，要自行處理AJAX的所有細節有點太浪費生命了，還是使用Open source的程式庫較好</li></ul></div> <iframe width="100%" height="250" frameborder="0" scrolling="yes" src="http://220.134.115.15/blogs/jquery.html"></iframe> 
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4183877.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4183877.html</guid>
	<category>JavaScript</category>
	<pubDate>Mon, 24 Sep 2007 00:34:47 +0800</pubDate>
</item>
<item>
	<title>在Xuite測試 jQuery</title>
	<description><![CDATA[
			如果您發現最近我的網誌似乎怪怪的，請別懷疑或擔心，因為最近正在Xuite上測試jQuery的功能。Xuite不知何時開始已使用了jQuery的AJAX功能，雖然版本不是昨天剛推出的1.2版而是1.1.2，但對我這個初學者而言應該是夠用了。  目前的目標是把原先純粹用JavaScript寫的擴充功能用jQuery重新實作，透過這樣的練習應該能很快掌握jQuery的精髓吧。順道一提，jQuery的專案開發網站也是使用Trac與Subversion在管理的。它使用的標誌似乎是河內之塔的模樣，不知有何特殊含義？    ##  
		]]>
	</description>
	<content:encoded><![CDATA[
			<p>如果您發現最近我的網誌似乎怪怪的，請別懷疑或擔心，因為最近正在Xuite上測試<a href="http://jquery.com/" target="_blank">jQuery</a>的功能。Xuite不知何時開始已使用了jQuery的AJAX功能，雖然版本不是昨天剛推出的1.2版而是1.1.2，但對我這個初學者而言應該是夠用了。<br /> <br /> 目前的目標是把原先純粹用JavaScript寫的擴充功能用jQuery重新實作，透過這樣的練習應該能很快掌握jQuery的精髓吧。順道一提，jQuery的<a href="http://dev.jquery.com/" target="_blank">專案開發網站</a>也是使用Trac與Subversion在管理的。它使用的標誌似乎是河內之塔的模樣，不知有何特殊含義？</p><p> <img src="http://static.jquery.com/files/design/images/jquery_logo.gif" alt="" /> <br /> <br /> ##<br />  </p>
		
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/4128397.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/4128397.html</guid>
	<category>JavaScript</category>
	<pubDate>Wed, 12 Sep 2007 19:20:34 +0800</pubDate>
</item>
<item>
	<title>變更MyBlogLog的onclick事件處理程式</title>
	<description><![CDATA[
			重新又把MyBlogLog
加回網頁。但當點擊訪客頭像圖形時，目前網頁會被訪客的MyBlogLog個人網頁給取代，當想要觀察多個訪客資訊時實在很麻煩，因此在
window.onload裡用下列指令把頭像圖形的onclick事件改成使用window.open，而形成以新視窗(或新分頁)的呈現方式。
程式片段：
  function changeMyBlogLogOnclick() {
    //if (isIE) return;
    var aTags = document.getElementsByTagName(&quot;td&quot;);
    var reg = new RegExp(&quot;mbl_img&quot;);
    for (var i in aTags) {
      //alert(aTags[i].className);
      if (reg.test(aTags[i].className)) {
        aTags[i].onclick =  function() {
          var _sUser = this.getAttribute(&quot;onclick&quot;);
          var _iIndex = _sUser.indexOf('&quot;');
          _sUser = _sUser.substring(_iIndex+1, _sUser.length-3);
          //console.log(_sUser);
          var _sURL = &quot;http://www.mybloglog.com/buzz/members/&quot;+_sUser;
          window.open(_sURL);
          //console.log(this.getAttribute(&quot;onclick&quot;));
        };
      }
    }
  } //~changeMyBlogLogOnclick

##


 dp.SyntaxHighlighter.HighlightAll('code'); 

		]]>
	</description>
	<content:encoded><![CDATA[
			<p>重新又把<a target="_blank" href="http://www.mybloglog.com">MyBlogLog</a>
加回網頁。但當點擊訪客頭像圖形時，目前網頁會被訪客的MyBlogLog個人網頁給取代，當想要觀察多個訪客資訊時實在很麻煩，因此在
window.onload裡用下列指令把頭像圖形的onclick事件改成使用window.open，而形成以新視窗(或新分頁)的呈現方式。<input type="hidden" value="MyBlogLog " id="mytag" /></p>
程式片段：<br />
<textarea cols="70" rows="10" class="javascript" name="code">  function changeMyBlogLogOnclick() {
    //if (isIE) return;
    var aTags = document.getElementsByTagName(&quot;td&quot;);
    var reg = new RegExp(&quot;mbl_img&quot;);
    for (var i in aTags) {
      //alert(aTags[i].className);
      if (reg.test(aTags[i].className)) {
        aTags[i].onclick =  function() {
          var _sUser = this.getAttribute(&quot;onclick&quot;);
          var _iIndex = _sUser.indexOf('&quot;');
          _sUser = _sUser.substring(_iIndex+1, _sUser.length-3);
          //console.log(_sUser);
          var _sURL = &quot;http://www.mybloglog.com/buzz/members/&quot;+_sUser;
          window.open(_sURL);
          //console.log(this.getAttribute(&quot;onclick&quot;));
        };
      }
    }
  } //~changeMyBlogLogOnclick
</textarea><br />
##


<script> dp.SyntaxHighlighter.HighlightAll('code'); </script>

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2971941.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2971941.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2971941.html</guid>
	<category>JavaScript</category>
	<pubDate>Sun, 08 Apr 2007 17:07:26 +0800</pubDate>
</item>
<item>
	<title>IE和FireFox存取同名物件有不同的作法</title>
	<description><![CDATA[
			
在將
部
落格
加上動態放大與縮小字體大小的功能這篇文章裡敘述了放
大與縮小文章內容字體大小的功能按鈕，這個功能在FireFox裡運作得很正常，但IE則無法運作，今天終於找到問題：
Xuite日誌在&lt;head&gt;區裡放了一個名為content的&lt;INPUT&gt;物件(&lt;input
type='Hidden' name='content'&gt;)，和放置文章內容的區域名稱(&lt;div id='content'&gt;)
衝突到了！我解決的方法是判斷瀏覽器，當使用IE時把要作用的控制項改成content的上一層mid，如此在IE裡也能正常運作了。接著寫了簡單的
script來驗證此問題之癥結。


  
    
      &lt;input
type=&quot;hidden&quot; name=&quot;TEXT1&quot;
title=&quot;Hidden TEXT1&quot;&gt;  &lt;!-- First TEXT1
--&gt;
      &lt;div
id=&quot;TEXT1&quot;
title=&quot;Div TEXT1&quot;&gt; &lt;!-- Second TEXT1 --&gt;
       
document.getElementById difference between IE &amp; FF
      &lt;/div&gt;
      
      &lt;script&gt;
       
var obj = document.getElementById('TEXT1');
       
document.write(&quot;obj title=&quot; + obj.title);
      &lt;/script&gt;
    
  


以下的script在網頁上放了兩個名稱同為TEXT1的物件，當使用document.getElementById('TEXT1')取物件時，在
IE 6裡取到的是第一個，而FireFox則取到第二個。這個應該是IE的問題吧．．．

##

		]]>
	</description>
	<content:encoded><![CDATA[
			
<p>在<a href="http://blog.xuite.net/emisjerry/tech/10760195">將
部
落格
加上動態放大與縮小字體大小的功能</a>這篇文章裡敘述了<span style="font-weight: bold;">放
大與縮小</span>文章內容字體大小的功能按鈕，這個功能在<a target="_blank" href="http://www.moztw.org">FireFox</a>裡運作得很正常，但IE則無法運作，今天終於找到問題：
Xuite日誌在&lt;head&gt;區裡放了一個名為<span style="font-weight: bold;">content</span>的&lt;INPUT&gt;物件(<span style="font-weight: bold;">&lt;input
type='Hidden' name='content'&gt;</span>)，和放置文章內容的區域名稱(<span style="font-weight: bold;">&lt;div id='content'&gt;</span>)
衝突到了！我解決的方法是判斷瀏覽器，當使用IE時把要作用的控制項改成content的上一層mid，如此在IE裡也能正常運作了。接著寫了簡單的
script來驗證此問題之癥結。<input type="hidden" value="javascript" id="mytag" /></p>
<br />
<table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(102, 102, 102); width: 90%;">
  <tbody>
    <tr>
      <td style="background-color: rgb(204, 255, 255);"><span style="font-family: Courier New;">&lt;input
type=&quot;hidden&quot; name=&quot;<span style="font-weight: bold;">TEXT1</span>&quot;
title=&quot;Hidden TEXT1&quot;&gt;  &lt;!-- First TEXT1
--&gt;</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;">&lt;div
id=&quot;<span style="font-weight: bold;">TEXT1</span>&quot;
title=&quot;Div TEXT1&quot;&gt; &lt;!-- Second TEXT1 --&gt;</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;"> 
document.getElementById difference between IE &amp; FF</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;">&lt;/div&gt;</span><br style="font-family: Courier New;" />
      <br style="font-family: Courier New;" />
      <span style="font-family: Courier New;">&lt;script&gt;</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;"> 
var obj = document.getElementById('TEXT1');</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;"> 
document.write(&quot;obj title=&quot; + obj.title);</span><br style="font-family: Courier New;" />
      <span style="font-family: Courier New;">&lt;/script&gt;</span></td>
    </tr>
  </tbody>
</table>
<br />
以下的script在網頁上放了兩個名稱同為TEXT1的物件，當使用document.getElementById('TEXT1')取物件時，在
IE 6裡取到的是第一個，而FireFox則取到第二個。這個應該是IE的問題吧．．．<br />
<br />
##

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2971701.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2971701.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2971701.html</guid>
	<category>JavaScript</category>
	<pubDate>Sun, 08 Apr 2007 15:40:54 +0800</pubDate>
</item>
<item>
	<title>[HTML&amp;CSS] 鎖定左側功能選單，不隨頁面捲動</title>
	<description><![CDATA[
			


為了把簡睿常用的工具網頁變更成更好閱讀的的樣式：用左右兩欄式，左側置放功能選單，右側則為主要
內容。為了方便套用，特別先製作一個簡單的樣板，在此留下記錄也提供給有相同需求的讀者參考。(按圖開新窗放大)


左側與右側各置放一個&lt;div&gt;，其ID分別為left與right，在left上在疊放另一個&lt;div
id=&quot;menu&quot;&gt;，主要的控制就是把left的position設
定固定(fixed)，這樣
就能把此區域鎖定在網頁上，不隨著右側內容的捲動而移動。IE則必須針對overflow做控制才能正確顯示。

測試網頁的執行請瀏覽這裡。
(樣板結構參考：http://www.pixelbeat.org/cmdline.html)

測試網頁源碼如下：
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;html lang=&quot;zh-tw&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;title&gt;鎖定左側功能選單，不隨頁面捲動&lt;/title&gt;
&lt;script&gt;
// 點擊功能選項時變更SPAN1顯示內容
function menu(i) {
document.getElementById('SPAN1').innerHTML = &quot;第&quot;+i+&quot;選項被按&quot;;
}
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
body {
margin: 0em;
padding: 0em;
}
#right {
padding: 1em;
height: 100%;
margin-left: 11em;
font-size: small;
width: auto;
text-align: justify;
}
#left {
background: #3399ff;
position: fixed;
top: 0;
left: 0;
width: 9em;
height: 100%;
color: black;
z-index: 3;
}
#menu {
background: #3399ff;
position: absolute;
top: 0;
left: 0;
width: 9em;
color: black;
z-index: 2;
height: 100%;
}
#menu a {
padding: 2px 2px 2px 4px;
background: #3366ff;
display: block;
text-decoration: none;
text-align: left;
color: #ffffc0;
margin-bottom: 1px;
}
#menu a:hover {
background: #3300ff;
color: #ff00ff;
}
&lt;/style&gt;
&lt;!--[if IE 6]&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;http://emisjerry.googlepages.com/IE6hack.css&quot; type=&quot;text/css&quot;/&gt;
&lt;![endif]--&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- Right-side main panel --&gt;
&lt;div id=&quot;right&quot;&gt;
&lt;span style='font-size:20px'&gt;鎖定左側功能選單，不隨頁面捲動&lt;/span&gt;&lt;br&gt;
&lt;span id=&quot;SPAN1&quot; style=&quot;color:red;&quot;&gt;&lt;/span&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;script&gt;
for (var i=1; i&lt;=100; i++) {
document.write(&quot;&lt;tr&gt;&lt;td&gt;第&quot; + i + &quot;列&lt;/td&gt;&lt;/tr&gt;&quot;);
}
&lt;/script&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&quot;left&quot;&gt;
&lt;div id=&quot;menu&quot;&gt;
&lt;script&gt;
for (var i=1; i&lt;=10; i++) {
document.write(&quot;&lt;a href='javascript:menu(&quot;+i+&quot;)'&gt;第&quot;+i+&quot;選項&lt;/a&gt;&quot;);
}
&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;



 dp.SyntaxHighlighter.HighlightAll('code'); 

		]]>
	</description>
	<content:encoded><![CDATA[
			
<a target="_blank" href="http://b.blog.xuite.net/b/3/a/c/11893557/blog_10351/txt/10910037/0.jpg">
<img vspace="10" hspace="20" src="http://b.blog.xuite.net/b/3/a/c/11893557/blog_10351/txt/10910037/0.jpg" alt="Division fixed" style="float: left; width: 349px; height: 246px;" /></a>
<p>為了把<a target="_blank" href="http://emisjerry.googlepages.com/jerrystool.html">簡睿常用的工具</a>網頁變更成更好閱讀的的樣式：用<span style="font-weight: bold;">左右兩欄</span>式，左側置放功能選單，右側則為主要
內容。為了方便套用，特別先製作一個簡單的樣板，在此留下記錄也提供給有相同需求的讀者參考。<span style="color: rgb(51, 153, 153);">(按圖開新窗放大)<input type="hidden" value="HTML CSS" id="mytag" /></span></p>
<br />
<br />
左側與右側各置放一個&lt;div&gt;，其ID分別為left與right，在left上在疊放另一個&lt;div
id=&quot;menu&quot;&gt;，主要的控制就是把left的<span style="font-weight: bold;">position</span>設
定固定(<span style="font-weight: bold;">fixed</span>)，這樣
就能把此區域鎖定在網頁上，不隨著右側內容的捲動而移動。IE則必須針對overflow做控制才能正確顯示。<br />
<br />
測試網頁的執行請<a target="_blank" href="http://emisjerry.googlepages.com/div-fixed.html">瀏覽這裡</a>。<br />
(樣板結構參考：<a target="_blank" href="http://www.pixelbeat.org/cmdline.html">http://www.pixelbeat.org/cmdline.html</a>)<br />
<br />
測試網頁源碼如下：<br />
<textarea cols="70" rows="10" class="html:showcolumns:collapse" name="code">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
&lt;html lang=&quot;zh-tw&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;
&lt;title&gt;鎖定左側功能選單，不隨頁面捲動&lt;/title&gt;
&lt;script&gt;
// 點擊功能選項時變更SPAN1顯示內容
function menu(i) {
document.getElementById('SPAN1').innerHTML = &quot;第&quot;+i+&quot;選項被按&quot;;
}
&lt;/script&gt;
&lt;style type=&quot;text/css&quot;&gt;
body {
margin: 0em;
padding: 0em;
}
#right {
padding: 1em;
height: 100%;
margin-left: 11em;
font-size: small;
width: auto;
text-align: justify;
}
#left {
background: #3399ff;
position: fixed;
top: 0;
left: 0;
width: 9em;
height: 100%;
color: black;
z-index: 3;
}
#menu {
background: #3399ff;
position: absolute;
top: 0;
left: 0;
width: 9em;
color: black;
z-index: 2;
height: 100%;
}
#menu a {
padding: 2px 2px 2px 4px;
background: #3366ff;
display: block;
text-decoration: none;
text-align: left;
color: #ffffc0;
margin-bottom: 1px;
}
#menu a:hover {
background: #3300ff;
color: #ff00ff;
}
&lt;/style&gt;
&lt;!--[if IE 6]&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;http://emisjerry.googlepages.com/IE6hack.css&quot; type=&quot;text/css&quot;/&gt;
&lt;![endif]--&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- Right-side main panel --&gt;
&lt;div id=&quot;right&quot;&gt;
&lt;span style='font-size:20px'&gt;鎖定左側功能選單，不隨頁面捲動&lt;/span&gt;&lt;br&gt;
&lt;span id=&quot;SPAN1&quot; style=&quot;color:red;&quot;&gt;&lt;/span&gt;
&lt;table border=&quot;1&quot;&gt;
&lt;tbody&gt;
&lt;script&gt;
for (var i=1; i&lt;=100; i++) {
document.write(&quot;&lt;tr&gt;&lt;td&gt;第&quot; + i + &quot;列&lt;/td&gt;&lt;/tr&gt;&quot;);
}
&lt;/script&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&quot;left&quot;&gt;
&lt;div id=&quot;menu&quot;&gt;
&lt;script&gt;
for (var i=1; i&lt;=10; i++) {
document.write(&quot;&lt;a href='javascript:menu(&quot;+i+&quot;)'&gt;第&quot;+i+&quot;選項&lt;/a&gt;&quot;);
}
&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea>
<script src="http://emisjerry.googlepages.com/shCore.js" language="javascript"></script><script src="http://emisjerry.googlepages.com/shBrushJScript.js" language="javascript"></script>

<script> dp.SyntaxHighlighter.HighlightAll('code'); </script>

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2960353.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2960353.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2960353.html</guid>
	<category>JavaScript</category>
	<pubDate>Thu, 05 Apr 2007 20:37:21 +0800</pubDate>
</item>
<item>
	<title>網頁顯示程式碼的美容師：CodePress</title>
	<description><![CDATA[
			

除
了介紹過的dp.SyntaxHighlighter:
在網頁顯示美觀的程式碼之外，SHJS
- Syntax Highlighting in JavaScript 是另一個在網頁上顯示各式程式語言的
JavaScript程式。我對SHJS並無太大興趣，但是對它在Links裡列出的其他類似工具中的CodePress倒
是下載測試了一下(按圖開新窗放大)。事實上dt.SyntaxHighlighter已經相當方便，且顯示在網頁上的效果也相當美觀，但似乎當顯示內容有中文
時，顯示的列距就有點重疊狀
況，有時造成檢視上的不便。

CodePress看來不錯，需要加的程式碼也很少，但因為我使用的Google Page Creator無法使用子目錄，而
CodePress需要用到兩個子目錄(engine和language)，我試著修改其codepress.html，但仍有些問題。如果您使用的網站
能使用目錄結構的話（我猜，應該是百分之九十九的系統都使用樹狀的目錄結構吧，只有Google是怪胎..:-)，CodePress是不錯的選擇。

##

		]]>
	</description>
	<content:encoded><![CDATA[
			
<a href="http://b.blog.xuite.net/b/3/a/c/11893557/blog_10351/txt/10774855/0.jpg" target="_blank"><img width="239" vspace="20" hspace="20" height="62" align="left" alt="CodePress" src="http://b.blog.xuite.net/b/3/a/c/11893557/blog_10351/txt/10774855/0.jpg" /></a><input type="hidden" id="mytag" value="CodePress SHJS" />
<p>除
了介紹過的<span class="titlename"></span><a href="http://blog.xuite.net/emisjerry/tech/10220407?p=2">dp.SyntaxHighlighter:
在網頁顯示美觀的程式碼</a>之外，<a target="_blank" href="http://shjs.sourceforge.net/index.html">SHJS
- Syntax Highlighting in JavaScript </a>是另一個在網頁上顯示各式程式語言的
JavaScript程式。我對SHJS並無太大興趣，但是對它在<a href="http://shjs.sourceforge.net/doc/links.html" target="_blank">Links</a>裡列出的其他類似工具中的<a style="font-weight: bold;" href="http://codepress.org/" target="_blank">CodePress</a>倒
是下載測試了一下<span style="color: rgb(51, 153, 153);">(按圖開新窗放大)</span>。</p>事實上dt.SyntaxHighlighter已經相當方便，且顯示在網頁上的效果也相當美觀，但似乎當顯示內容有中文
時，顯示的列距就有點<span style="font-weight: bold;">重疊</span>狀
況，有時造成檢視上的不便。<br />
<br />
CodePress看來不錯，需要加的程式碼也很少，但因為我使用的<a href="http://pages.google.com" target="_blank">Google Page Creator</a>無法使用子目錄，而
CodePress需要用到兩個子目錄(engine和language)，我試著修改其codepress.html，但仍有些問題。如果您使用的網站
能使用目錄結構的話（我猜，應該是百分之九十九的系統都使用樹狀的目錄結構吧，只有Google是怪胎..:-)，CodePress是不錯的選擇。<br />
<br />
##

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2920003.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2920003.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2920003.html</guid>
	<category>JavaScript</category>
	<pubDate>Tue, 27 Mar 2007 23:18:07 +0800</pubDate>
</item>
<item>
	<title>JavaScript Collector: 包羅萬象的JavaScript檔案庫</title>
	<description><![CDATA[
			


 JavaScript
Collector蒐集了200多個JavaScript的
各式程式技巧，它以客戶端的執行檔呈現，除了能參考作者由許多網站蒐集來的小技巧外，也能自行
新增自己的程式片段進去，因此也能當做自學或工作上的程式檔案庫。更令人激賞的，所有的程式都能用IE、FireFox或Opera等瀏覽器預覽，能在最
短時間內找到能使用的功能。(按圖開新窗放大)

JavaScript Collector分成下列幾大類：
Background Effects Banners Calculators Cookies Counters Date and Time Email Scripts Forms Games Generators Image Effects Link Effects Misc Mouse Effects Navigation Redirection Scrollers Text Effects Tools &amp; Utilities User Information Window StatusBar Effects Window Title Effects Window 
##


		]]>
	</description>
	<content:encoded><![CDATA[
			
<input type="hidden" id="mytag" value="JavascriptCollector" />
<a href="http://www.greencow.se/images/jsc/main.gif" target="_blank">
<img vspace="20" hspace="20" align="left" style="width: 200px; height: 179px;" alt="JavaScript Collector" src="http://www.greencow.se/images/jsc/main.gif" /></a><a href="http://www.greencow.se"> JavaScript
Collector</a>蒐集了200多個<span style="font-weight: bold;">JavaScript</span>的
各式程式技巧，它以客戶端的執行檔呈現，除了能參考作者由許多網站蒐集來的小技巧外，也能自行
新增自己的程式片段進去，因此也能當做自學或工作上的程式檔案庫。更令人激賞的，所有的程式都能用IE、FireFox或Opera等瀏覽器預覽，能在最
短時間內找到能使用的功能。<span style="color: rgb(51, 102, 255);">(按圖開新窗放大)</span><br />
<br />
JavaScript Collector分成下列幾大類：<br />
<ul style="list-style-type: square; color: rgb(102, 0, 204); font-family: Arial;"><li><big>Background Effects </big></li><li><big>Banners </big></li><li><big>Calculators </big></li><li><big>Cookies </big></li><li><big>Counters </big></li><li><big>Date and Time </big></li><li><big>Email Scripts </big></li><li><big>Forms </big></li><li><big>Games </big></li><li><big>Generators </big></li><li><big>Image Effects </big></li><li><big>Link Effects </big></li><li><big>Misc </big></li><li><big>Mouse Effects </big></li><li><big>Navigation </big></li><li><big>Redirection </big></li><li><big>Scrollers </big></li><li><big>Text Effects </big></li><li><big>Tools &amp; Utilities </big></li><li><big>User Information </big></li><li><big>Window StatusBar Effects </big></li><li><big>Window Title Effects </big></li><li><big>Window</big> </li></ul>
##


		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2886471.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2886471.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2886471.html</guid>
	<category>JavaScript</category>
	<pubDate>Tue, 20 Mar 2007 21:42:53 +0800</pubDate>
</item>
<item>
	<title>IE會自動把標籤轉成大寫！</title>
	<description><![CDATA[
			
我在上一篇替部落格的側邊欄位加上縮起與展開功能的最後面說：不知為何，IE執行上會有問題，FireFox則正常，最後找到的問題又是IE和FireFox的差異造成的。原來程式為了偷懶，使用innerHTML而未以DOM來操作，結果IE把所有的標籤都自動轉換成大寫(＜li&gt;文章分類&lt;/li&gt;在IE裡變成＜LI&gt;文章分類&lt;/LI&gt;)，導致程式無法判斷正確，加了轉換成小寫來判斷後就OK了。原來的寫法：var _iIndex = _sHTML.indexOf(&quot;&lt;/li&gt;&quot;);  // 在IE裡因會變大寫，致無法找到修改後的正確寫法：var _iIndex = _sHTML.toLowerCase().indexOf(&quot;&lt;/li&gt;&quot;);##

		]]>
	</description>
	<content:encoded><![CDATA[
			
我在上一篇<span class="titlename"><a href="http://blog.xuite.net/emisjerry/tech/10639626" target="_blank">替部落格的側邊欄位加上縮起與展開功能</a>的最後面說：<span style="text-decoration: underline;">不知為何，IE執行上會有問題，FireFox則正常</span>，最後找到的問題又是IE和FireFox的差異造成的。<br /><br />原來程式為了偷懶，使用innerHTML而未以DOM來操作，結果IE把所有的標籤都<span style="font-weight: bold;">自動轉換成大寫</span>(＜li&gt;文章分類&lt;/li&gt;在IE裡變成＜LI&gt;</span><span class="titlename">文章分類&lt;/LI&gt;)</span><span class="titlename">，導致程式無法判斷正確，加了轉換成小寫來判斷後就OK了。<br /><br />原來的寫法：<br /></span><table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(102, 102, 102); width: 90%;"><tbody><tr><td style="background-color: rgb(255, 255, 204);"><span style="font-family: Courier New;">var _iIndex = _sHTML.indexOf(&quot;&lt;/li&gt;&quot;);</span> <span style="color: rgb(0, 153, 0); font-style: italic;"> // 在IE裡因會變大寫，致無法找到</span></td></tr></tbody></table><br />修改後的正確寫法：<br /><table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(102, 102, 102); width: 90%; font-family: Courier New;"><tbody><tr><td style="background-color: rgb(255, 255, 204);">var _iIndex = _sHTML.<span style="font-weight: bold;">toLowerCase()</span>.indexOf(&quot;&lt;/li&gt;&quot;);</td></tr></tbody></table><br />##<span class="titlename"></span>

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2882481.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2882481.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2882481.html</guid>
	<category>JavaScript</category>
	<pubDate>Mon, 19 Mar 2007 22:54:21 +0800</pubDate>
</item>
<item>
	<title>事件處理程式與物件的順序對FireFox很重要</title>
	<description><![CDATA[
			
在IE裡，從來也不用去管表單控制項(＜INPUT...&gt;)與事件程式(＜script for=...
 event=...&gt;)的先後位置，＜script-for-event&gt;只做類似宣告的動作，在讀取網頁內容時不會去檢查
INPUT 產生與否，被觸發時才會執行。但此二者的前後位置對於FireFox而言卻是非常重要。

以下皆為FireFox的特性：

1.先寫事件會產生錯誤；事件處理程式寫在控制項後面才是正確的：

  
    
      &lt;script&gt;
        document.getElementById('btnOK').onclick = function() {  // has no properties錯誤
          alert(&quot;btnOK pressed!&quot;);
        };
      &lt;/script&gt;
      ....
      &lt;input  id='btnOK'  value='OK'&gt;
    
  


2.最保險的寫法是把事件處理程式寫在window.onload的程式裡：

  
    
      &lt;script&gt;
  window.onload = function() {
          document.getElementById('btnOK').onclick = function() { 
            alert(&quot;btnOK pressed!&quot;);
          };
  };
      &lt;/script&gt;
      ....
      &lt;input  id='btnOK'  value='OK'&gt;  // 控制項的位置無關緊要了
    
  


能這樣寫的原因是：window.onload必定在網頁全部都讀取完畢後才會被執行。2007/03/04修訂：為免混淆，將「物件」改成表單控制項或控制項。

##

		]]>
	</description>
	<content:encoded><![CDATA[
			
在IE裡，從來也不用去管<span style="font-weight: bold;">表單控制項</span>(＜INPUT...&gt;)與事件程式(＜script for=...
 event=...&gt;)的先後位置，＜script-for-event&gt;只做類似宣告的動作，在讀取網頁內容時不會去檢查
INPUT 產生與否，被觸發時才會執行。但此二者的前後位置對於FireFox而言卻是<span style="font-weight: bold;">非常重要</span>。<br />
<br />
以下皆為FireFox的特性：<br />
<br />
1.先寫事件會產生錯誤；事件處理程式寫在<span style="font-weight: bold;">控制項</span>後面才是正確的：<br />
<table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(0, 102, 0); width: 100%;">
  <tbody>
    <tr>
      <td style="background-color: rgb(255, 255, 204);"><span style="font-family: Courier New,Courier,monospace;">&lt;script&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">  document.getElementById('btnOK').onclick = function() {  // </span><span style="color: rgb(255, 0, 0); font-family: Courier New,Courier,monospace;">has no properties錯誤<br />
      <span style="color: rgb(0, 0, 0);">    alert(&quot;btnOK pressed!&quot;);</span><br style="font-family: Courier New,Courier,monospace;" />
      </span><span style="font-family: Courier New,Courier,monospace;">  };</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">&lt;/script&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">....</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">&lt;input  id='btnOK'  value='OK'&gt;</span></td>
    </tr>
  </tbody>
</table>
<br />
2.最保險的寫法是把事件處理程式寫在window.onload的程式裡：<br />
<table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(0, 102, 0); width: 100%;">
  <tbody>
    <tr>
      <td style="background-color: rgb(255, 255, 204);"><span style="font-family: Courier New,Courier,monospace;">&lt;script&gt;<br />
  window.onload = function() {<br style="font-family: Courier New,Courier,monospace;" />
      </span><span style="font-family: Courier New,Courier,monospace;">    document.getElementById('btnOK').onclick = function() { </span><span style="color: rgb(255, 0, 0); font-family: Courier New,Courier,monospace;"><br />
      </span><span style="color: rgb(255, 0, 0); font-family: Courier New,Courier,monospace;"><span style="color: rgb(0, 0, 0);">      alert(&quot;btnOK pressed!&quot;);</span></span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">    };<br />
  };<br style="font-family: Courier New,Courier,monospace;" />
      </span><span style="font-family: Courier New,Courier,monospace;">&lt;/script&gt;</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">....</span><br style="font-family: Courier New,Courier,monospace;" />
      <span style="font-family: Courier New,Courier,monospace;">&lt;input  id='btnOK'  value='OK'&gt;  <span style="color: rgb(0, 102, 0);">// </span></span><span style="font-weight: bold; color: rgb(0, 153, 0);">控制項</span><span style="font-family: Courier New,Courier,monospace; color: rgb(0, 153, 0);">的位置無關緊要了</span></td>
    </tr>
  </tbody>
</table>
<br />
能這樣寫的原因是：<span style="font-weight: bold;">window.onload必定在網頁全部都讀取完畢後才會被執行</span>。<br /><br /><span style="color: rgb(51, 51, 255);">2007/03/04修訂：為免混淆，將「物件」改成表單控制項或控制項。</span><br />
<br />
##

		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2795121.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2795121.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2795121.html</guid>
	<category>JavaScript</category>
	<pubDate>Sat, 03 Mar 2007 00:19:47 +0800</pubDate>
</item>
<item>
	<title>將IE網頁轉換成FireFox也能執行</title>
	<description><![CDATA[
			
開始著手將IE網頁轉換成FireFox也能執行。以下是我測試後的兩個註記：
document.all 在FireFox裡仍然能使用一般的文件與書籍都提及要用document.getElementById來取代IE專屬的document.all，但
在FireFox 2.0.0.2裡document.all是能正常運作的事實上在2004年已經有支援document.all的寫法了：
Mozilla Supports document.all (Almost)不過，為了能支援別的瀏覽器，還是改用document.getElementById為宜&lt;script for=&quot;...&quot; event=&quot;...&quot;&gt;是IE的專屬語法，但奇怪的是&lt;script for=&quot;window&quot; event=&quot;onload&quot;&gt;卻能使用，原來以為會否是window物件的所有事件都有支援，但unload卻又不行。網頁裡的事件幾乎都是用&lt;script for=&quot;...&quot; event=&quot;...&quot;&gt;的寫法，目前想到的改法是：&lt;script for=Button1 event=onclick&gt;  alert(&quot;onclick!&quot;);&lt;/script&gt;==改寫成==&gt;&lt;script&gt;  document.getElementById('Button1').onclick = function() {    alert(&quot;onclick!&quot;);  };&lt;/script&gt;參考：
轉
換網頁程式：從 IE 到 Mozilla原文的簡體翻譯：把应用程序从 Internet Explorer 迁移到 Mozilla Javascript的IE和FF兼容性汇编##
		]]>
	</description>
	<content:encoded><![CDATA[
			
開始著手將IE網頁轉換成<a target="_blank" href="http://www.mozilla.org/firefox">FireFox</a>也能執行。以下是我測試後的兩個註記：<br />
<ul><li><span style="font-weight: bold;">document.all </span>在FireFox裡仍然能使用</li><ul><li>一般的文件與書籍都提及要用document.getElementById來取代IE專屬的document.all，但
在FireFox 2.0.0.2裡document.all是能正常運作的</li><li>事實上在2004年已經有支援document.all的寫法了：
<a target="_blank" href="http://mozillanews.org/?article_date=2004-07-23+18-06-59">Mozilla Supports document.all (Almost)</a></li><li>不過，為了能支援別的瀏覽器，還是改用document.getElementById為宜<br /></li></ul><li>&lt;script for=&quot;...&quot; event=&quot;...&quot;&gt;是IE的專屬語法，但奇怪的是<span style="font-weight: bold;">&lt;script for=&quot;window&quot; event=&quot;onload&quot;&gt;</span>卻能使用，原來以為會否是window物件的所有事件都有支援，但unload卻又不行。</li></ul>網頁裡的事件幾乎都是用&lt;script for=&quot;...&quot; event=&quot;...&quot;&gt;的寫法，目前想到的改法是：<br /><table cellspacing="1" cellpadding="2" border="0" style="text-align: left; background-color: rgb(0, 102, 0); width: 100%;"><tbody><tr><td style="background-color: rgb(255, 255, 204);">&lt;script for=Button1 event=onclick&gt;<br />  alert(&quot;onclick!&quot;);<br />&lt;/script&gt;</td><td style="background-color: rgb(255, 255, 255);">==改寫成==&gt;</td><td style="background-color: rgb(255, 255, 204);">&lt;script&gt;<br />  document.getElementById('Button1').onclick = function() {<br />    alert(&quot;onclick!&quot;);<br />  };<br />&lt;/script&gt;</td></tr></tbody></table><br /><span style="font-style: italic;"><br /></span>參考：<br /><ul><li><span style="font-style: italic;"></span>
<a target="_blank" href="http://developer.mozilla.org/zh_tw/docs/%E8%BD%89%E6%8F%9B%E7%B6%B2%E9%A0%81%E7%A8%8B%E5%BC%8F%EF%BC%9A%E5%BE%9E_IE_%E5%88%B0_Mozilla">轉
換網頁程式：從 IE 到 Mozilla</a></li><ul><li>原文的簡體翻譯：<a target="_blank" href="http://www.ibm.com/developerworks/cn/web/wa-ie2mozgd/index.html">把应用程序从 Internet Explorer 迁移到 Mozilla</a> </li></ul><li><a target="_blank" href="http://www.shanghuo.net/?action=show&id=68">Javascript的IE和FF兼容性汇编</a></li></ul>##<br />
		<a class="acontinues" href="http://blog.roodo.com/emisjerry/archives/2783279.html">(繼續閱讀...)</a>
		]]>
	</content:encoded>
	<link>http://blog.roodo.com/emisjerry/archives/2783279.html</link>
	<guid>http://blog.roodo.com/emisjerry/archives/2783279.html</guid>
	<category>JavaScript</category>
	<pubDate>Wed, 28 Feb 2007 22:39:58 +0800</pubDate>
</item>
</channel>
</rss>