<?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>เทคนิคการเขียนเว็บ เขียนโปรแกรม php คัดมา เน้น ๆ : webshowpow.com &#187; ตัวเลข</title>
	<atom:link href="http://www.webshowpow.com/tag/%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webshowpow.com</link>
	<description>เทคนิคการเขียนเว็บ เขียนโปรแกรม php คัดมา เน้น ๆ</description>
	<lastBuildDate>Thu, 01 Dec 2011 10:20:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>ใ้ช้ jQuery ตรวจสอบ ต้องกรอกตัวเลขเท่านั้น</title>
		<link>http://www.webshowpow.com/%e0%b9%83%e0%b9%89%e0%b8%8a%e0%b9%89-jquery-%e0%b8%81%e0%b8%a3%e0%b8%ad%e0%b8%81%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%80%e0%b8%97%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%b1%e0%b9%89/</link>
		<comments>http://www.webshowpow.com/%e0%b9%83%e0%b9%89%e0%b8%8a%e0%b9%89-jquery-%e0%b8%81%e0%b8%a3%e0%b8%ad%e0%b8%81%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%80%e0%b8%97%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%b1%e0%b9%89/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 10:17:07 +0000</pubDate>
		<dc:creator>แว่นตก</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[keycode]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[กรอก]]></category>
		<category><![CDATA[ตัวอักษร]]></category>
		<category><![CDATA[ตัวเลข]]></category>
		<category><![CDATA[ป้องกัน]]></category>
		<category><![CDATA[แป้นพิมพ์]]></category>
		<category><![CDATA[ไม่ซ้ำ]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=138</guid>
		<description><![CDATA[เมื่อใน form เรามี textbox เผื่อใส่เฉพาะตัวอักษร เราจะมีวิธีในการป้องกันการตัวอักษรตัวอื่นดังนี้ 1 2 3 4 5 6 7 8 9 10 $&#40;&#34;#txtboxToFilter&#34;&#41;.keydown&#40;function&#40;event&#41; &#123; &#160; if &#40;&#40;event.keyCode == 8 // backspace &#124;&#124; event.keyCode == 46 // [...]]]></description>
			<content:encoded><![CDATA[<p>เมื่อใน form เรามี textbox เผื่อใส่เฉพาะตัวอักษร<br />
เราจะมีวิธีในการป้องกันการตัวอักษรตัวอื่นดังนี้</p>

<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: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#txtboxToFilter&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keydown</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">8</span>           <span style="color: #006600; font-style: italic;">// backspace</span>
        <span style="color: #339933;">||</span> event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">46</span>    <span style="color: #006600; font-style: italic;">// delete</span>
        <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">48</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">57</span><span style="color: #009900;">&#41;</span>   <span style="color: #006600; font-style: italic;">// numbers on keyboard</span>
        <span style="color: #339933;">||</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">&gt;=</span> <span style="color: #CC0000;">96</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">&lt;=</span> <span style="color: #CC0000;">105</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #006600; font-style: italic;">// number on keypad</span>
        <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
           <span style="color: #006600; font-style: italic;">// Do Something</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>หัวใจของ code นี้คือ keyCode ซึ่งจะให้ค่าเป็นตัวเลขในแต่ละแป้นพิมพ์<br />
ในแต่แป้นพิมพ์จะมีเลขที่ไม่ซ้ำกัน</p>
<p>&nbsp;</p>
<p>ที่มา</p>
<p>http://stackoverflow.com/questions/995183/how-to-allow-only-numeric-0-9-in-html-inputbox-using-jquery</p>
<p>&nbsp;</p>
<blockquote><p>หวังว่าคงจะสามารถเอาไปใช้งานกันได้นะครับ</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b9%83%e0%b9%89%e0%b8%8a%e0%b9%89-jquery-%e0%b8%81%e0%b8%a3%e0%b8%ad%e0%b8%81%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%80%e0%b8%97%e0%b9%88%e0%b8%b2%e0%b8%99%e0%b8%b1%e0%b9%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีการหาตัวเลขแบบไม่ซ้ำ ใน array</title>
		<link>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/</link>
		<comments>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/#comments</comments>
		<pubDate>Wed, 25 May 2011 11:36:16 +0000</pubDate>
		<dc:creator>แว่นตก</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[ตัวเลข]]></category>
		<category><![CDATA[หา]]></category>
		<category><![CDATA[ไม่ซ้ำ]]></category>

		<guid isPermaLink="false">http://www.webshowpow.com/?p=38</guid>
		<description><![CDATA[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 &#60;?php $num=3; $arr = array&#40;&#34;1&#34;,&#34;2&#34;,&#34;3&#34;,&#34;4&#34;,&#34;5&#34;,&#34;6&#34;,&#34;7&#34;,&#34;8&#34;&#41;; $count_arr=count&#40;$arr&#41;; &#160; $arrName= array&#40;&#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
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$num</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;1&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;2&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;3&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;4&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;6&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;7&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$count_arr</span><span style="color: #339933;">=</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$arrName</span><span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$idx</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$idx</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> 
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$id_rand</span> <span style="color: #339933;">=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$count_arr</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id_rand</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$arrName</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$arrName</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$idx</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #000088;">$arr</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id_rand</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$idx</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> 
&nbsp;
<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arrName</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>โดยที่<br />
$num คือ จำนวนตัวเลขที่ต้องการ<br />
$arr คือ array ที่เก็บข้อมูลตัวเลข</p>
<p>&nbsp;</p>
<blockquote><p>จริง ๆ แล้วเอาไปประยุกต์ใช้กับตัวอักษรก็ได้นะ <img src='http://www.webshowpow.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></blockquote>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.webshowpow.com/%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b1%e0%b8%a7%e0%b9%80%e0%b8%a5%e0%b8%82%e0%b9%81%e0%b8%9a%e0%b8%9a%e0%b9%84%e0%b8%a1%e0%b9%88%e0%b8%8b%e0%b9%89%e0%b8%b3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

