<?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>STUDIO KINGDOM &#187; javascript</title>
	<atom:link href="http://www.studio-kingdom.com/category/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.studio-kingdom.com</link>
	<description>PHPによるWebプログラミングやAdobeソフトによるWEBデザインなどなど</description>
	<lastBuildDate>Tue, 31 Mar 2009 15:37:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Yahoo UIに入門してみた</title>
		<link>http://www.studio-kingdom.com/javascript/410</link>
		<comments>http://www.studio-kingdom.com/javascript/410#comments</comments>
		<pubDate>Sun, 25 Jan 2009 12:23:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.studio-kingdom.com/?p=410</guid>
		<description><![CDATA[				最近浅く広い、この手のエントリ多いです。Yahoo UIが何気に優秀という噂を聞きつけて、どうしても試してみたくなったので。
				Ajaxのおさらいをしていて、ちょうどYahooUIの項目もあったのでサンプル [...]]]></description>
			<content:encoded><![CDATA[				<p>最近浅く広い、この手のエントリ多いです。Yahoo UIが何気に優秀という噂を聞きつけて、どうしても試してみたくなったので。<br />
				Ajaxのおさらいをしていて、ちょうどYahooUIの項目もあったのでサンプルプログラムを改良して、多少実践向けにして晒してみたくなったという事情もあります。<br />
				おさらいに使用した本はこちら。</p>
				<div class="amazlet-box" style="margin:10px 30px">
				<div class="amazlet-image" style="float: left"><a name="amazletlink" href="http://www.amazon.co.jp/exec/obidos/ASIN/4798112968/studiokingdom-22/ref=nosim/" target="_blank"><img style="border-top-style: none; border-right-style: none; border-left-style: none; border-bottom-style: none" src="http://ecx.images-amazon.com/images/I/41EIwLc32RL._SL160_.jpg" alt="10日でおぼえるAjax 入門教室" /></a></div>
				<div class="amazlet-info" style="float: left; margin-left: 15px; line-height: 120%">
				<div class="amazlet-name" style="margin-bottom: 10px; line-height: 120%"><a name="amazletlink" href="http://www.amazon.co.jp/exec/obidos/ASIN/4798112968/studiokingdom-22/ref=nosim/" target="_blank">10日でおぼえるAjax 入門教室</a></p>
				<div class="amazlet-powered-date" style="margin-top: 5px; font-size: 7pt; line-height: 120%; font-family: verdana">posted with <a title="10日でおぼえるAjax 入門教室" href="http://www.amazlet.com/browse/ASIN/4798112968/studiokingdom-22/ref=nosim/" target="_blank">amazlet</a> at 09.01.25</div>
				</div>
				<div class="amazlet-detail">漆尾 貴義<br />
				翔泳社<br />
				売り上げランキング: 120488</div>
				<div class="amazlet-link" style="margin-top: 5px"><a name="amazletlink" href="http://www.amazon.co.jp/exec/obidos/ASIN/4798112968/studiokingdom-22/ref=nosim/" target="_blank">Amazon.co.jp で詳細を見る</a></div>
				</div>
				</div>
				<div style="clear:both"></div>
				<p>この本、結構おススメ。IEでAjaxする方法を解説⇒次はFireFoxで⇒各ブラウザ毎に処理を振り分け⇒innterHTMLやCSSの説明⇒prototype.js登場といった感じで、Ajaxに必要なことを基礎から追って順に説明してくれるので分かりやすいです。<br />
				<a href="http://www.openspc2.org/JavaScript/Ajax/ref/YahooUI/ver2.2.0/">Yahoo UI Library リファレンス</a>の[■Calendar]⇒[Calendar]も参考にしてます。<br />
				で、カスタマイズしたプログラムはこんな感じ。</p>
				<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="image" src="http://www.studio-kingdom.com/wp-content/uploads/2009/01/image11.png" border="0" alt="image" width="210" height="241" /></p>
				<ul>
				<li>カレンダー表示リンクを押すとカレンダーが表示。</li>
				<li>入力欄が空でリンクを押された場合は当月を表示、日付が入力されていたら対象月を表示。</li>
				<li>カレンダー上で日付をクリックするとyyyy/mm/dd形式で入力欄に日付が入り、カレンダーが閉じる。</li>
				<li><span style="color: #ff0000;">(入力欄の日付エラーチェックはしてません。アルファベットとか入れるとトンデモカレンダーが表示されます(&gt;_&lt;))</span></li>
				</ul>
				<p>では、実際に作ってみましょう。まずはYahooUIをダウンロードしてきます。<br />
				<a title="http://developer.yahoo.com/yui/" href="http://developer.yahoo.com/yui/">http://developer.yahoo.com/yui/</a></p>
				<p><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="image" src="http://www.studio-kingdom.com/wp-content/uploads/2009/01/image12.png" border="0" alt="image" width="430" height="275" /></p>
				<p>使用するのはbuildフォルダ内のファイル群になります。作成するプログラムと同じフォルダ階層にbuildフォルダを移し、フォルダ名をyuiに変更してください。<br />
				肝心のプログラムは、下記の通り。</p>
				<pre class="brush: jscript;">
&lt;!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Yahoo UI カレンダー入力&lt;/title&gt;
&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;yui/yahoo/yahoo.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;yui/dom/dom.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;yui/event/event.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;yui/calendar/calendar.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;prototype.js&quot;&gt;&lt;/script&gt;
&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;yui/calendar/assets/calendar.css&quot;&gt;
&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
// &lt;![CDATA[
function onloaded(){
Element.hide(&quot;cal1Container&quot;);
}

function showCal(arg){
var cal1;

var ary_arg;
var json_arg;
var json_pagedate;
var json_selected;

var tmp_dt;
var tmp_dt_year;
var tmp_dt_month;
var tmp_dt_date;

//YAHOO.widget.Calendarオブジェクトに渡すjson引数値
//josn引数設定例　{ pagedate:&quot;2/2007&quot;,selected:&quot;2/10/2007-2/15/2007&quot;}
if(arg){
ary_arg = arg.split(&quot;/&quot;);	//[0]=年　[1]=月　[2]=日
json_pagedate = ary_arg[1] + &quot;/&quot; + ary_arg[0];
json_selected = ary_arg[1] + &quot;/&quot; + ary_arg[2] + &quot;/&quot; + ary_arg[0];
json_arg = '{ pagedate:&quot;' + json_pagedate + '&quot;,selected:&quot;' + json_selected + '&quot;}';
}

//カレンダー描画
if(arg){
cal1 = new YAHOO.widget.Calendar(&quot;cal1&quot;,&quot;cal1Container&quot;, eval(&quot;(&quot;+json_arg+&quot;)&quot;));
} else {
cal1 = new YAHOO.widget.Calendar(&quot;cal1&quot;,&quot;cal1Container&quot;);
}

cal1.selectEvent.subscribe(function(type,args) {
//alert(cal1.getSelectedDates()[0]);
tmp_dt = cal1.getSelectedDates()[0];
tmp_dt_year = tmp_dt.getFullYear();
tmp_dt_month = tmp_dt.getMonth() + 1;
tmp_dt_date = tmp_dt.getDate();
document.form1.set_dt.value = tmp_dt_year + &quot;/&quot; + tmp_dt_month + &quot;/&quot; + tmp_dt_date;
Element.hide(&quot;cal1Container&quot;);
});
cal1.render();
Element.show(&quot;cal1Container&quot;);
}
// ]]&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload=&quot;onloaded()&quot;&gt;
&lt;form name=&quot;form1&quot;&gt;
&lt;input id=&quot;set_dt&quot; type=&quot;text&quot; value=&quot;&quot; size=&quot;12&quot; /&gt;
&lt;a href=&quot;javascript:void(0)&quot; onclick=&quot;showCal(document.form1.set_dt.value)&quot;&gt;カレンダー表示&lt;/a&gt;
&lt;div id=&quot;cal1Container&quot;&gt;&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
				<p>変数がやたら多くて美しくないですなぁ、即興で作ったのでご勘弁を。<br />
				バグ等あったら教えてください。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.studio-kingdom.com/javascript/410/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
