<?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>聰明的生活2 &#187; prototype</title>
	<atom:link href="http://blog.yslifes.com/archives/category/program/javascript/prototype/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yslifes.com</link>
	<description>自己寫java程式的一些筆記</description>
	<lastBuildDate>Wed, 08 Feb 2012 02:26:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<atom:link rel='hub' href='http://blog.yslifes.com/?pushpress=hub'/>
		<item>
		<title>[php]簡單的購物車範例</title>
		<link>http://blog.yslifes.com/archives/718</link>
		<comments>http://blog.yslifes.com/archives/718#comments</comments>
		<pubDate>Thu, 23 Sep 2010 14:08:19 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[程式]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[opensource]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/718</guid>
		<description><![CDATA[簡單的購物車範例，不需要操作Session，範例有新增、修改與刪除購物車等，主要是修改 [Class]參考 sCart 建立的購物車 Class，這個範例年代久遠，所以在使用時有發生問題也不知道怎麼處理，所以小修了一下。 程式的概念是有一個產品展示頁面，有加入購物車功能，加入購物車後，可以至下一頁修改數量或刪除產品，修改或刪除產品時總金額也會隨著一起更新，再下一頁就可以看到最後結帳的最終資訊，理論上可以在這裡製作聯絡資料的表單。 產品展示頁面 原始碼Product.php &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34; /&#62; &#60;title&#62;購物車加入範例&#60;/title&#62; &#60;script type=&#34;text/javascript&#34; src=&#34;js/menu.js&#34;&#62;&#60;/script&#62; &#60;link rel=&#34;shortcut icon&#34; href=&#34;images/i.ico&#34; /&#62; &#60;/head&#62; &#60;body&#62; &#60;div class=&#34;right_main&#34;&#62; &#160; &#60;div class=&#34;product clearfix&#34;&#62; &#60;div class=&#34;product_body fle&#34;&#62; &#60;div class=&#34;product_poto fle&#34;&#62;&#60;/div&#62; &#60;div class=&#34;product_word fle&#34;&#62; &#60;div class=&#34;product_word_tit&#34;&#62;測試資料&#60;/div&#62; &#60;div class=&#34;product_word_word&#34;&#62;規 格：122&#60;br [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/718/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>[jsp]利用Google Map查詢經緯度</title>
		<link>http://blog.yslifes.com/archives/622</link>
		<comments>http://blog.yslifes.com/archives/622#comments</comments>
		<pubDate>Mon, 26 Apr 2010 13:47:37 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/622</guid>
		<description><![CDATA[如果手上有一堆地址清單想要知道它們的經緯度如何？要怎麼做呢？這裡介紹一個很簡單的方法，利用二個Ajax及Google Map就可以完成，一個要求地址欄位及key值（這其實可以直接全都先輸出成javascript的Array就好了），另一個接收到經緯度資料後回傳給Server做儲存（這也可以直接利用一個TextArea存放，到時再複製起來存放），而Google Map最主要的功能就是把地址轉換成經緯度。 做法及想法如下： 1.建立資料庫Table 需要有一個pk值、地址、經度、緯度及一個記錄是否已取得成功的註記符號，MySQL語法如下： ps.先建立幾筆資料做測試，如下insert 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 CREATE TABLE `test`.`Address` &#40; `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `zip_name` VARCHAR&#40;45&#41; NOT NULL, `address` VARCHAR&#40;500&#41; NOT NULL, `latitude` VARCHAR&#40;100&#41;, `longitude` VARCHAR&#40;100&#41;, `flg` VARCHAR&#40;1&#41;, PRIMARY KEY &#40;`id`&#41; &#41; ENGINE = InnoDB; &#160; INSERT [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/622/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>prototype Ajax回傳json物件的處理</title>
		<link>http://blog.yslifes.com/archives/620</link>
		<comments>http://blog.yslifes.com/archives/620#comments</comments>
		<pubDate>Sun, 25 Apr 2010 00:02:03 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jsp]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[教學]]></category>
		<category><![CDATA[json]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/620</guid>
		<description><![CDATA[一般人在設計ajax成功回傳事件時，有幾種方式來處理回傳的資料，一種是純文字或html code，一種是xml格式那另一種就是json格式，json格式不像xml需要成對的tag，所以在回傳資料長度上會顯的短很快，如果整個網站都大量使用ajax方法的話，選擇json是一個很好的方法。 json的相關資訊可以在這裡看到：JSON in JavaScript prototype這個framework本身就有支援To JSON的方法，有二種格式可以轉換成json，一種是javascript的class，另一種就是純文字了，不過純文字的內容要為json格式才能被轉換，如下： &#123;&#34;bindings&#34;: &#91; &#123;&#34;ircEvent&#34;: &#34;PRIVMSG&#34;, &#34;method&#34;: &#34;newURI&#34;, &#34;regex&#34;: &#34;^http://.*&#34;&#125;, &#123;&#34;ircEvent&#34;: &#34;PRIVMSG&#34;, &#34;method&#34;: &#34;deleteURI&#34;, &#34;regex&#34;: &#34;^delete.*&#34;&#125;, &#123;&#34;ircEvent&#34;: &#34;PRIVMSG&#34;, &#34;method&#34;: &#34;randomURI&#34;, &#34;regex&#34;: &#34;^random.*&#34;&#125; &#93; &#125;; 所以在設計ajax response文字時，就特意的輸出成json格式的內容，再利用prototype轉成json物件，那就可以在javascript裡直接使用了。 以下用一個簡單的例子來說明，form request ajax要求一個查詢，查詢經由一個jsp做處理，處理好後輸出json格式回傳給剛才的request，接收到response後，轉換成javascript的json物件，再取出物件內容來顯示在畫面上。 底下是prototype Ajax的寫法，直接用form上的設定當成request，然後再處理responseText就可以了。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/620/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Javascript]AutoComplete自動完成效果</title>
		<link>http://blog.yslifes.com/archives/619</link>
		<comments>http://blog.yslifes.com/archives/619#comments</comments>
		<pubDate>Fri, 23 Apr 2010 23:48:39 +0000</pubDate>
		<dc:creator>yku</dc:creator>
				<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[autocomplete]]></category>

		<guid isPermaLink="false">http://blog.yslifes.com/archives/619</guid>
		<description><![CDATA[之前為了做這AutoComplete效果找了好多資料，不過大都是jQuery的，當然不是不好用，只是在一個頁面載入prototype跟jQeruy就會有些衝突的問題要解決。 效果大概會像下面這樣子 作者的資訊如下： Ajax Autocomplete for Prototype, version 1.0.3 (c) 2008 Tomas Kirda http://www.devbridge.com/projects/autocomplete/ 雖然版本不是很新，不過很完整，只要在自己需要的地方再做些修改就可以了 範例提供如下： 以下提供一個範例，只需開啟AutoComplete.html然後輸入Li ，就會由response.html回傳一個json格式顯示出來。 下載點： 範例畫面 使用方法 載入prototype1.6版本 載入autocomplete.js 載入Autocomplete用的css 建立一個input輸入區 new 一個Autocomplete告知來啟動這個效果 以下是大程式部份 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 &#60;script type=&#34;text/javascript&#34; src=&#34;js/prototype.js&#34; &#62;&#60;/script&#62; &#60;script type=&#34;text/javascript&#34; [...]]]></description>
		<wfw:commentRss>http://blog.yslifes.com/archives/619/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

