<?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>mrKrich™ &#187; JavaScript</title>
	<atom:link href="http://beta.mrkrich.com/category/development/javascript-miscellenous/feed/" rel="self" type="application/rss+xml" />
	<link>http://beta.mrkrich.com</link>
	<description>The happen things around me</description>
	<lastBuildDate>Fri, 09 Sep 2011 08:00:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Page Redirection</title>
		<link>http://beta.mrkrich.com/2009/12/page-redirection/</link>
		<comments>http://beta.mrkrich.com/2009/12/page-redirection/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 11:33:21 +0000</pubDate>
		<dc:creator>mrkrich</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://beta.mrkrich.com/?p=197</guid>
		<description><![CDATA[เมื่อวันก่อนมีน้องมาถามเกี่ยวกับเรื่อง Page Redirection ก็เลยคิดว่าจะเอามาเป็นพูดถึงเสียหน่อย
การ redirect หน้าเว็บ คือการส่งหน้าเว็บที่เปิดอยู่ปัจจุบันไปยังหน้าอื่น สามารถทำได้ 3 ระดับดังนี้

ระดับ HTTP Header
ระดับ HTML Header
ระดับ Script


1. ระดับ HTTP Header
เป็นวิธีที่ใช้ได้กับทุก Browser สะดวกรวดเร็ว เพราะไม่จำเป็นจะต้องมีการ render หน้าเว็บ หรือ html tag ใดๆเลย
ตัวอย่างการใช้งาน (PHP)
&#60;?
header(&#8220;location: http://www.google.com&#8221;);
?&#62;
2. ระดับ HTML Header
เป็นวิธีที่ใช้ได้กับทุก Browser เหมือนกับระดับ HTTP Header แต่สามารถใช้ได้กับเว็บที่ไม่ได้ใช้ CGI แต่จะช้ากว่าเนื่องจากใช้ html tag ในการบอก Browser ให้ทำการ redirect
ตัวอย่างการใช้งาน
&#60;html&#62;
&#60;head&#62;
&#60;meta http-equiv=&#8221;refresh&#8221; content=&#8221;2;url=http://www.google.com&#8221;&#62;
&#60;/head&#62;
&#60;/html&#62;
3. ระดับ Script
เป็นวิธีที่นิยมใช้กันมาก เนื่องจากสามารถสร้างเงื่อนไขต่างๆในการทำงานให้กับการ redirect ได้ ซึ่งในวิธีการนี้จะใช้ global object <a href="http://beta.mrkrich.com/2009/12/page-redirection/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>เมื่อวันก่อนมีน้องมาถามเกี่ยวกับเรื่อง Page Redirection ก็เลยคิดว่าจะเอามาเป็นพูดถึงเสียหน่อย</p>
<p>การ redirect หน้าเว็บ คือการส่งหน้าเว็บที่เปิดอยู่ปัจจุบันไปยังหน้าอื่น สามารถทำได้ 3 ระดับดังนี้</p>
<ul>
<li>ระดับ HTTP Header</li>
<li>ระดับ HTML Header</li>
<li>ระดับ Script</li>
</ul>
<p><span id="more-197"></span></p>
<h3>1. ระดับ HTTP Header</h3>
<p>เป็นวิธีที่ใช้ได้กับทุก Browser สะดวกรวดเร็ว เพราะไม่จำเป็นจะต้องมีการ render หน้าเว็บ หรือ html tag ใดๆเลย</p>
<p>ตัวอย่างการใช้งาน (PHP)</p>
<blockquote><p>&lt;?</p>
<p>header(&#8220;location: http://www.google.com&#8221;);</p>
<p>?&gt;</p></blockquote>
<h3>2. ระดับ HTML Header</h3>
<p>เป็นวิธีที่ใช้ได้กับทุก Browser เหมือนกับระดับ HTTP Header แต่สามารถใช้ได้กับเว็บที่ไม่ได้ใช้ CGI แต่จะช้ากว่าเนื่องจากใช้ html tag ในการบอก Browser ให้ทำการ redirect</p>
<p>ตัวอย่างการใช้งาน</p>
<blockquote><p>&lt;html&gt;</p>
<p>&lt;head&gt;</p>
<p>&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;2;url=http://www.google.com&#8221;&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;/html&gt;</p></blockquote>
<h3>3. ระดับ Script</h3>
<p>เป็นวิธีที่นิยมใช้กันมาก เนื่องจากสามารถสร้างเงื่อนไขต่างๆในการทำงานให้กับการ redirect ได้ ซึ่งในวิธีการนี้จะใช้ global object ที่ชื่อ location และมีวิธีการใช้งาน 2 แบบด้วยกัน</p>
<h4>3.1 แบบ property &#8211; href</h4>
<p>วิธีการนี้เป็นเหมือน link ปกติคือมีการเก็บ history เอาไว้ สามารถกดปุ่ม back กลับมายังหน้าปัจจุบันได้</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>location.href = &#8220;http://www.google.com&#8221;;</p>
<p>&lt;/script&gt;</p></blockquote>
<h4>3.2 แบบ function &#8211; replace</h4>
<p>วิธีนี้เป็นการแทนที่ใน history เดิม ทำให้ไม่สามารถกดปุ่ม back กลับมายังหน้าปัจจุบันได้</p>
<blockquote><p>&lt;script type=&#8221;text/javascript&#8221;&gt;</p>
<p>location.replace(&#8220;http://www.google.com&#8221;);</p>
<p>&lt;/script&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://beta.mrkrich.com/2009/12/page-redirection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript GetElementsByClass</title>
		<link>http://beta.mrkrich.com/2009/01/javascript-getelementsbyclass/</link>
		<comments>http://beta.mrkrich.com/2009/01/javascript-getelementsbyclass/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 05:42:00 +0000</pubDate>
		<dc:creator>mrKrich</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[stylesheet]]></category>

		<guid isPermaLink="false">http://beta.mrkrich.com/?p=103</guid>
		<description><![CDATA[today, i have any reason to search HTML element by class name but javascript is not have support function. so i found somethings in the internet but not as good as i need. but i can modify it as i want. so it&#8217;s be like this.


String.prototype.trim = function() { return this.replace(/^\s+&#124;\s+$/g, &#8221;); };
Document.prototype.getElementsByClass = function( <a href="http://beta.mrkrich.com/2009/01/javascript-getelementsbyclass/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>today, i have any reason to search HTML element by class name but javascript is not have support function. so i found somethings in the internet but not as good as i need. but i can modify it as i want. so it&#8217;s be like this.</p>
<div>
<blockquote>
<div>String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, &#8221;); };</div>
<div>Document.prototype.getElementsByClass = function( searchClass, tagName) {</div>
<div><span style="white-space:pre"> </span>if (tagName == null) tagName = &#8216;*&#8217;;</div>
<div><span style="white-space:pre"> </span>var el = new Array();</div>
<div><span style="white-space:pre"> </span>var tags = this.getElementsByTagName(tagName);</div>
<div><span style="white-space:pre"> </span>var tcl = &#8221; &#8220;+searchClass.trim()+&#8221; &#8220;;</div>
<div><span style="white-space:pre"> </span>for(i=0,j=0; i</p>
<div><span style="white-space:pre"> </span>var test = &#8221; &#8221; + tags[i].className + &#8221; &#8220;;</div>
<div><span style="white-space:pre"> </span>if (test.indexOf(tcl) != -1)</div>
<div><span style="white-space:pre"> </span>el[j++] = tags[i];</div>
<div><span style="white-space:pre"> </span>}</div>
<div><span style="white-space:pre"> </span>return el;</div>
<div>};</div>
</div>
</blockquote>
</div>
]]></content:encoded>
			<wfw:commentRss>http://beta.mrkrich.com/2009/01/javascript-getelementsbyclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dojo Toolkit</title>
		<link>http://beta.mrkrich.com/2007/02/dojo-toolkit/</link>
		<comments>http://beta.mrkrich.com/2007/02/dojo-toolkit/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 16:50:00 +0000</pubDate>
		<dc:creator>mrKrich</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://beta.mrkrich.com/?p=74</guid>
		<description><![CDATA[When I try to learn more about Dojo Toolkit. I found some problem of its script. such as uncompatible   of javascript and css style sheet. And on downloaded demo, It have too many debug message. No downloadable manual or document. (It have just wiki for manual.)
But its script is too excellence and so <a href="http://beta.mrkrich.com/2007/02/dojo-toolkit/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>When I try to learn more about Dojo Toolkit. I found some problem of its script. such as uncompatible   of javascript and css style sheet. And on downloaded demo, It have too many debug message. No downloadable manual or document. (It have just wiki for manual.)</p>
<p>But its script is too excellence and so exciting with easy way. just like &#8216;taglib&#8217; in Java. (Or another language)</p>
<p>today I waste too much time to find and read manual.  But you can found sample in demo section.</p>
]]></content:encoded>
			<wfw:commentRss>http://beta.mrkrich.com/2007/02/dojo-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic HTML tips</title>
		<link>http://beta.mrkrich.com/2007/02/dynamic-html-tips/</link>
		<comments>http://beta.mrkrich.com/2007/02/dynamic-html-tips/#comments</comments>
		<pubDate>Wed, 14 Feb 2007 14:33:00 +0000</pubDate>
		<dc:creator>mrKrich</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://beta.mrkrich.com/?p=73</guid>
		<description><![CDATA[Hello it&#8217;s valentine again, Last 4 valentine ago. I used to have new web diary. 4 years later I have new one. &#8220;Dynamic HTML tips&#8221; is it.
It talk about HTML, Javascript and CSS Style Sheet tips. That may help newbie to create his/her own website with text editor. (I think manually coding HTML code is <a href="http://beta.mrkrich.com/2007/02/dynamic-html-tips/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Hello it&#8217;s valentine again, Last 4 valentine ago. I used to have new web diary. 4 years later I have new one. &#8220;<a href="http://html.mrkrich.com/">Dynamic HTML tips</a>&#8221; is it.</p>
<p>It talk about HTML, Javascript and CSS Style Sheet tips. That may help newbie to create his/her own website with text editor. (I think manually coding HTML code is more beautiful.)</p>
]]></content:encoded>
			<wfw:commentRss>http://beta.mrkrich.com/2007/02/dynamic-html-tips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>dojo &#8211; the javascript toolkit</title>
		<link>http://beta.mrkrich.com/2007/02/dojo-the-javascript-toolkit/</link>
		<comments>http://beta.mrkrich.com/2007/02/dojo-the-javascript-toolkit/#comments</comments>
		<pubDate>Mon, 05 Feb 2007 17:12:00 +0000</pubDate>
		<dc:creator>mrKrich</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://beta.mrkrich.com/?p=71</guid>
		<description><![CDATA[Ummm too many times ago. I try to write and javascript by myself. today my boss said &#8220;Why dont you try dojo toolkit for you ajax or javascript?&#8221;
I ask him for dojo like &#8220;what dojo is?&#8221; or &#8220;how its better than specific javascript?&#8221; because i think &#8220;Ajax is so easy and javascript i&#8217;m not newbie&#8221;
The <a href="http://beta.mrkrich.com/2007/02/dojo-the-javascript-toolkit/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Ummm too many times ago. I try to write and javascript by myself. today my boss said &#8220;Why dont you try <a href="http://dojotoolkit.org/">dojo toolkit</a> for you ajax or javascript?&#8221;</p>
<p>I ask him for dojo like &#8220;what dojo is?&#8221; or &#8220;how its better than specific javascript?&#8221; because i think &#8220;Ajax is so easy and javascript i&#8217;m not newbie&#8221;</p>
<p>The first time of its demo. It attack my ego. Its great tool that provide beautiful web object, ajax and another. I don&#8217;t know how can it work. Or how difficult is it for specific perpose.</p>
<p>but I know one,  Its demo is too excellence.</p>
]]></content:encoded>
			<wfw:commentRss>http://beta.mrkrich.com/2007/02/dojo-the-javascript-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

