<?xml version="1.0" encoding="Shift_JIS"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Web Study</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/" />
   <link rel="self" type="application/atom+xml" href="http://elmblog.com/web/study/atom.xml" />
   <id>tag:elmblog.com,2007:/web/study//6</id>
   <updated>2007-08-10T13:54:38Z</updated>
   
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.31-ja</generator>

<entry>
   <title>Wordpress XHTML</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/code/001074.php" />
   <id>tag:elmblog.com,2007:/web/study//6.1074</id>
   
   <published>2007-08-10T13:28:56Z</published>
   <updated>2007-08-10T13:54:38Z</updated>
   
   <summary><![CDATA[WordpressではW3Cスタンダード準拠を推奨しており、Valid XHTLをクリックすると、このページが正しいかを診断してくれる。忘れがちになるのが、下記の表記である。 タグの最後は　&gt;　ではなく　/&gt;　にする imgでのalt指定 aの入れ子にimgを書くと画像は表示されない。altテキストが表示される。 a, span, fontの入れ子にpがある p, div, ul, liなどのタグの閉じ忘れ ※Wordpressの imgタグでaltがないと、FireFoxでは表示されなくなる。IE7でも画像の枠が表示されるが、画像は表示されない。...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="Code" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="109" label="XHTML" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[WordpressではW3Cスタンダード準拠を推奨しており、<a href="http://validator.w3.org/check/referer">Valid XHTL</a>をクリックすると、このページが正しいかを診断してくれる。忘れがちになるのが、下記の表記である。
<ul>
<li>タグの最後は　&gt;　ではなく　/&gt;　にする</li>
<li>imgでのalt指定</li>
<li>aの入れ子にimgを書くと画像は表示されない。altテキストが表示される。
<li>a, span, fontの入れ子にpがある</li>
<li>p, div, ul, liなどのタグの閉じ忘れ
</ul>
※Wordpressの imgタグでaltがないと、FireFoxでは表示されなくなる。IE7でも画像の枠が表示されるが、画像は表示されない。]]>
      
   </content>
</entry>
<entry>
   <title>常駐プロセス</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/vista/001069.php" />
   <id>tag:elmblog.com,2007:/web/study//6.1069</id>
   
   <published>2007-08-05T08:02:46Z</published>
   <updated>2007-08-05T10:02:54Z</updated>
   
   <summary>Windows XP, Vistaでは、自分の知らないプログラムが隠れて動き、CPUを１００％占有したり、コトコトとディスクのアクセスが頻繁に起きることがある。そのためにレスポンスが極端に遅くなり、作業が滞ることがある。知らないプログラムが勝手に動くのは薄気味が悪いし、スパイウェアではないかと気になるものである。 これは「プロセス」と呼ばれるもので、OSが正常動作するために必要な常駐プログラムが多いのだが、実際には不要なものがある。Win高速化のソフトがあって、不要なプロセスを削除できるが、本当に削除していいのかが分からない。ひとつひとつ確認して削除しないと余計なトラブルの原因にもなる。 どんなプロセスがあるのかを検索できるサイト「Windows プロセス検索」が便利である。プロセスの調べ方も詳しく書いてある。 &amp;#10070;スタート→すべてのプログラム→スタートアップ &amp;#10070;タスクバー左端を右クリックして「タスクマネージャ」を選択 &amp;#10070;スタート→msconfig 検索･実行　（中上級者用） ★スタートアップ項目一覧（パソコンによってかなり違う） 　Windows Defender（MSASCui）：　Vistaファイアウォール 　Java Platform SE 6　(jusched） : Java のアップデートに必要 　Intel CUI (igfxtray): Intel 810 グラフィック関連。外してもOK 　Intel CUI (hkcmd): マルチメディアデバイスに必要らしいが外してもOK 　Intel CUI (igfxpers): NVidiaグラフィックカード関連のプロセス 　Synaptics Pointing Device (SynTPenh): TouchPad用 　Quick...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="Vista" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[Windows XP, Vistaでは、自分の知らないプログラムが隠れて動き、CPUを１００％占有したり、コトコトとディスクのアクセスが頻繁に起きることがある。そのためにレスポンスが極端に遅くなり、作業が滞ることがある。知らないプログラムが勝手に動くのは薄気味が悪いし、スパイウェアではないかと気になるものである。


これは「プロセス」と呼ばれるもので、OSが正常動作するために必要な常駐プログラムが多いのだが、実際には不要なものがある。Win高速化のソフトがあって、不要なプロセスを削除できるが、本当に削除していいのかが分からない。ひとつひとつ確認して削除しないと余計なトラブルの原因にもなる。


どんなプロセスがあるのかを検索できるサイト「<a href="http://process.a-windows.com/">Windows プロセス検索</a>」が便利である。<a href="http://process.a-windows.com/windowsxp.html">プロセスの調べ方</a>も詳しく書いてある。


&#10070;スタート→すべてのプログラム→スタートアップ
&#10070;タスクバー左端を右クリックして「タスクマネージャ」を選択
&#10070;スタート→msconfig 検索･実行　（中上級者用）


★スタートアップ項目一覧（パソコンによってかなり違う）
　Windows Defender（MSASCui）：　Vistaファイアウォール
　Java Platform SE 6　(jusched） : Java のアップデートに必要
　Intel CUI (igfxtray): Intel 810 グラフィック関連。外してもOK
　Intel CUI (hkcmd): マルチメディアデバイスに必要らしいが外してもOK
　Intel CUI (igfxpers): NVidiaグラフィックカード関連のプロセス
　Synaptics Pointing Device (SynTPenh): TouchPad用
　Quick Time (qttask): なくてもOK
　Google Toolbar Notifier (GoogleToolbarNotifier): なくてもOK


★不要なプロセス
　ctfmon: Office XP検索用。過大なディスクアクセス発生。
　msmsgs: MSNメッセンジャー用
　realsched: Real Playerの自動アップデート用]]>
      
   </content>
</entry>
<entry>
   <title>画像の入れ替え</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/001047.php" />
   <id>tag:web.elmblog.com,2007:/study//6.1047</id>
   
   <published>2007-04-07T02:49:38Z</published>
   <updated>2007-04-07T03:37:34Z</updated>
   
   <summary><![CDATA[ Free JavaScripts provided by The JavaScript Source ＜スクリプト例＞ &lt;script type="text/javascript"&gt; &lt;!-- Begin function Swap1over() { &nbsp; document.image1.src="画像１" } function Swap1out() { &nbsp; document.image1.src="画像２" } // End --&gt; &lt;/script&gt; ＜画像入れ替えのIMGタグ＞ &lt;div align="center"&gt; &lt;img src="画像２" name="image1" border="0" onMouseOver="Swap1over()" onMouseOut="Swap1out()"&gt; &lt;/div&gt;...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[<div align="center">
<img src="http://elmblog.com/icon/iee1.gif" name="image1" border="0" onMouseOver="Swap1over()" onMouseOut="Swap1out()">
</div>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<p>＜スクリプト例＞

&lt;script type="text/javascript"&gt;
&lt;!-- Begin
function Swap1over() {
&nbsp; document.image1.src="画像１"
}
function Swap1out() {
&nbsp; document.image1.src="画像２"
}
// End --&gt;
&lt;/script&gt;


＜画像入れ替えのIMGタグ＞

&lt;div align="center"&gt;
&lt;img src="画像２" name="image1" border="0" onMouseOver="Swap1over()" onMouseOut="Swap1out()"&gt;
&lt;/div&gt;</p>]]>
      
   </content>
</entry>
<entry>
   <title>アドレス情報 Location</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/001035.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1035</id>
   
   <published>2006-12-24T05:17:33Z</published>
   <updated>2007-08-08T22:05:54Z</updated>
   
   <summary><![CDATA[◆window.location.xxxxxx href の値が "http://www.example.com:2096/aaa/index.cgi?key=pc#home" のとき、各ｘｘｘｘｘｘの値は以下のようになる。 protocol: &quot;http:&quot; ・host: &quot;www.example.com:2096&quot; ・hostname: &quot;www.example.com&quot; ・port: &quot;2096&quot; ・pathname: &quot;/aaa/index.cgi&quot; ・search: &quot;?key=pc&quot; ・hash: &quot;#home&quot;...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[<p>◆window.location.xxxxxx<br>
href の値が "http://www.example.com:2096/aaa/index.cgi?key=pc#home" のとき、各ｘｘｘｘｘｘの値は以下のようになる。</p>
<pre>protocol: &quot;http:&quot;
・host:     &quot;www.example.com:2096&quot;
・hostname: &quot;www.example.com&quot;
・port:     &quot;2096&quot;
・pathname: &quot;/aaa/index.cgi&quot;
・search:   &quot;?key=pc&quot;
・hash:     &quot;#home&quot;</pre>
]]>
      
   </content>
</entry>
<entry>
   <title>Document</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/001034.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1034</id>
   
   <published>2006-12-24T03:38:23Z</published>
   <updated>2006-12-24T05:03:41Z</updated>
   
   <summary>◆文書の書き込み　document.write(msg [, msg...])document.writeln(&quot;&quot;);document.writeln(&quot;document.write　−文字列を書き込む。&quot;); document.writeln(&quot;document.writeln−最後に改行する。&quot;); document.writeln(&quot;document.URL―文書のアドレス(URL)：&quot;,document.URL); document.writeln(&quot;document.domain―文書のドメイン名：&quot;,document.domain); document.writeln(&quot;&quot;);...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[◆文書の書き込み　document.write(msg [, msg...])<script language="JavaScript">document.writeln("<pre>");document.writeln("document.write　−文字列を書き込む。");
document.writeln("document.writeln−最後に改行する。");
document.writeln("document.URL―文書のアドレス(URL)：",document.URL);
document.writeln("document.domain―文書のドメイン名：",document.domain);
document.writeln("</pre>");</script>]]>
      <![CDATA[◆最新更新時刻　document.lastModifie<script language="JavaScript">
document.write(" ： " + document.lastModified);</script>


◆リンク元URL　document.referrer
<script language="JavaScript">
if (document.referrer) {
    document.write("　　あなたは");    document.write(document.referrer);    document.write("からやってきましたね。");
}</script>


◆色・背景色
　・document.bgColor
　・document.fgColor
　・document.linkColor
　・document.alinkColor
　・document.vlinkColor
色の値を指定して、背景色を変更する。<form action="#">
<input type="button" value="red" onclick="document.bgColor='red'"><input type="button" value="green" onclick="document.bgColor='green'"><input type="button" value="blue" onclick="document.bgColor='blue'">
</form>]]>
   </content>
</entry>
<entry>
   <title>指定URL以外からのリンク拒否</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/001031.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1031</id>
   
   <published>2006-12-24T03:04:34Z</published>
   <updated>2007-08-08T22:04:20Z</updated>
   
   <summary><![CDATA[http://example.com/からしかリンクできないようにする。 リンク先につぎのスクリプトを書く。 &lt;script language=&quot;JavaScript&quot;&gt; x = document.referrer; y = &quot;http://example.com/&quot;; if (x!=y) { window.location= &quot;ng.html&quot;; } &lt;/script&gt;...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="61" label="JavaScript" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[http://example.com/からしかリンクできないようにする。
リンク先につぎのスクリプトを書く。
<code>&lt;script language=&quot;JavaScript&quot;&gt;
 x = document.referrer;
 y = &quot;http://example.com/&quot;;
if (x!=y) {
window.location= &quot;ng.html&quot;; 
}
&lt;/script&gt;</code>]]>
      
   </content>
</entry>
<entry>
   <title>Date 日付の設定</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/phpscript/001028.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1028</id>
   
   <published>2006-11-23T14:29:32Z</published>
   <updated>2007-08-08T21:55:45Z</updated>
   
   <summary><![CDATA[ＳＮＳソフトを米国設置のサーバにインストールしているため、日付が米国中部時間になる。これを日本時間で表示したいのだが・・・。 整数time()に現在時刻が Unix エポック (1970 年 1 月 1 日 00:00:00 GMT) からの通算秒が入っている。これに時差の１６時間を秒単位で足して、$jatimeに入れる。この$jatimeをdate関数で書式変換して表示すれば良いことが分かった。 &lt;?php $jatime=time()+(16*60*60);$today = date(&quot;Ymd g:i a&quot;,$jatime); echo ($today);?&gt;　　⇒...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="PhpScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[ＳＮＳソフトを米国設置のサーバにインストールしているため、日付が米国中部時間になる。これを日本時間で表示したいのだが・・・。
整数time()に現在時刻が Unix エポック (1970 年 1 月 1 日 00:00:00 GMT) からの通算秒が入っている。これに時差の１６時間を秒単位で足して、$jatimeに入れる。この$jatimeをdate関数で書式変換して表示すれば良いことが分かった。
<div style="border:solid gray 1px;">&lt;?php $jatime=time()+(16*60*60);$today = date(&quot;Ymd g:i a&quot;,$jatime); echo ($today);?&gt;　　⇒<font color=red><?php $jatime=time()+(16*60*60);$today = date("Ymd g:i a",$jatime); echo ($today);?></font></div>]]>
      
   </content>
</entry>
<entry>
   <title>PEAR Packages</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/phpscript/001026.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1026</id>
   
   <published>2006-11-23T13:34:21Z</published>
   <updated>2007-08-08T21:59:18Z</updated>
   
   <summary>PerlやJavaScriptと同様にphpにも世界的なコミュニティが存在する。 再利用可能なphp部品が、こちらから無料で入手できる。 ※PEARは、PHP Extension and Application Repository の省略形である。PEARの詳細についてホームページ http://pear.php.net/ を参照。日本語マニアルは、http://pear.php.net/manual/ja/ にある。...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="PhpScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[PerlやJavaScriptと同様にphpにも世界的なコミュニティが存在する。
再利用可能なphp部品が、<a href="http://pear.php.net/packages.php">こちらから</a>無料で入手できる。
※PEARは、PHP Extension and Application Repository の省略形である。PEARの詳細についてホームページ http://pear.php.net/ を参照。日本語マニアルは、http://pear.php.net/manual/ja/ にある。]]>
      
   </content>
</entry>
<entry>
   <title>ＵＲＬに変数と値を指定する</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/phpscript/001025.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1025</id>
   
   <published>2006-11-23T12:11:05Z</published>
   <updated>2006-12-24T02:01:10Z</updated>
   
   <summary>たとえば、ブラウザから http:/site.com/index.php?a=hello を呼び出すことを考える。?よりあとの文字列a=helloをphpで受け取って処理することができる。...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="PhpScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="80" label="php" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[たとえば、ブラウザから http:/site.com/index.php<b>?a=hello</b> を呼び出すことを考える。?よりあとの文字列a=helloをphpで受け取って処理することができる。]]>
      <![CDATA[@サーバの register_globals 設定が On の場合
　a　は変数名、hello は値で、ｐｈｐコード内の変数 <b>$a</b> に値 hello を渡していることになる。つまり phpコードで、$a=&quot;help&quot; と書いたのと同じになる。

［例］http://web.elmblog.com/study/archives/phpscript/001025.php?a=hello
<div style="border: solid gray 1px;">&lt;?php echo ($a); ?&gt;　　⇒<font color=red><?php echo ($a);?></font></div>
この記事のPermalink?a=hello（［例］のアドレス）を呼び出すと hello と表示される。helloを別の文字列にして確認する。日本語、たとえば ?a=今日は と書いて呼び出す。上の⇒の右側に表示される。


Aregister_globalsが off の場合
　$_GET["a"]　で取得できる。$_GET["a"] に　?a=hello の値 hello が入っている。

<div style="border: solid gray 1px;">［例］&lt;?php echo ($_GET["a"]); ?&gt;　　⇒<font color=red><?php echo ($_GET["a"]);?></font></div>


※register_globalsの設定は、php.iniファイルに「register_globals = on」と書いて、http:/site.com/フォルダにphp.iniファイルを保存すればよい。レンタルサーバの機能を確認すること。
※JavaScriptの location.search には ?a=hello が渡される。
【注意】register_globalsはセキュリティ上OFFにしたほうが良い。]]>
   </content>
</entry>
<entry>
   <title>Smartyテンプレートエンジン</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/phpscript/001024.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1024</id>
   
   <published>2006-11-16T13:12:29Z</published>
   <updated>2007-08-08T21:59:41Z</updated>
   
   <summary>XoopsやOpenPNEで使われているSmatyテンプレートエンジンは、コンテンツをプログラムから分離して開発するのに適している。アプリケーションデザインを志す人はＳｍａｒｔｙを学習し使いこなせるようになると便利である。Smartyの日本語訳ドキュメントもある。...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="PhpScript" scheme="http://www.sixapart.com/ns/types#category" />
         <category term="Template" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="80" label="php" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[XoopsやOpenPNEで使われているSmatyテンプレートエンジンは、コンテンツをプログラムから分離して開発するのに適している。アプリケーションデザインを志す人はＳｍａｒｔｙを学習し使いこなせるようになると便利である。Smartyの<a href="http://sunset.freespace.jp/smarty/SmartyManual_2-6-1J_html/">日本語訳</a>ドキュメントもある。]]>
      　オープンソース開発のプログラムを使っているときに気になるのが、そのプログラムをアップグレードしたときに旧プログラムを使って作成したコンテンツの上位互換性・移行性が確保できるかということである。せっかく苦労してコンテンツを開発したのにプログラムをアップグレードしたら既存コンテンツが使えないというのでは困る。とくに人気のあるオープンソースは開発も活発で、機能追加やバグ修正が多い。毎月一回アップグレードというものもある。新しいリリースを使いたいが移行したら動かないというのでは困る。

　Ｗｅｂの構成やページのデザインなどほとんどの部分はHTMLとＣＳＳで追加・変更できるが、プログラムに手を入れないと変更できない部分もある。そのプログラムがPHPやＰｅｒｌ、JavaScriptなどＷｅｂ用のスクリプト言語で書かれていると、見よう見まねで改造できるものである。しかし、変に改造するとアップグレードのときに再度書き直しをしなければならず面倒である。これに対処するためにSmartyというテンプレートエンジンが用いられる。

Smaryはｐｈｐで書かれたWebアプリケーションのロジックとコンテンツを分離して管理することを容易にしてくれる。CMSやＳＮＳなどのようにコンテンツが頻繁に追加・編集されるアプリケーションでは、ロジックの開発者とアプリケーションのデザイナは違い、並行開発するほうが効率的である。同時にSmartyをそのアプリケーション利用者に公開することにより、利用者側で独自のデザインができる。ロジックが変更されてもアプリケーションのデザインは影響されないというメリットがある。
   </content>
</entry>
<entry>
   <title>How to make a fav-icon?</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/study/001009.php" />
   <id>tag:web.elmblog.com,2006:/study//6.1009</id>
   
   <published>2006-11-05T04:22:46Z</published>
   <updated>2007-08-08T21:57:50Z</updated>
   
   <summary>ＩＥやＦｉｒｅｆｏｘなどのブラウザーでアドレス欄およびお気に入り（ブックマーク）で表示される小さなアイコンを favicon という。Ｗｅｂサイトのルートフォルダーに保存して、ブラウザでアクセスしたときにそのＷｅｂのアイコンを表示させることができる。詳しい説明が http://www.rw-designer.com/favicon にある。...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="Study" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="28" label="Web" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[ＩＥやＦｉｒｅｆｏｘなどのブラウザーでアドレス欄およびお気に入り（ブックマーク）で表示される小さなアイコンを favicon という。Ｗｅｂサイトのルートフォルダーに保存して、ブラウザでアクセスしたときにそのＷｅｂのアイコンを表示させることができる。詳しい説明が <a href="http://www.rw-designer.com/favicon">http://www.rw-designer.com/favicon</a> にある。
<img src="http://www.rw-designer.com/res/favicon-firefox.png" border="0" align="left" hspace=10">]]>
      
   </content>
</entry>
<entry>
   <title>任意に選択したテキストの表示</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/phpscript/000979.php" />
   <id>tag:web.elmblog.com,2006:/study//6.979</id>
   
   <published>2006-08-23T14:58:33Z</published>
   <updated>2006-08-23T15:28:12Z</updated>
   
   <summary><![CDATA[選択の対象となるテキストをquote.txtに保存しておく。テキスト間は改行コードで区切る。 テキストのなかに書式を指定するHTMLタグを書いておくことができる。どこまでのタグが使えるかの確認テストはしていない。 &lt;?php srand((double)microtime()*1000000); $quote = file(&quot;quote.txt&quot;); $today = array_rand($quote, 2); $msg = $quote[$today[0]]; echo $msg; ?&gt; Sample:...]]></summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="PhpScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="80" label="php" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[選択の対象となるテキストをquote.txtに保存しておく。テキスト間は改行コードで区切る。
テキストのなかに書式を指定するHTMLタグを書いておくことができる。どこまでのタグが使えるかの確認テストはしていない。
<div class=box><pre>&lt;?php
srand((double)microtime()*1000000);
$quote = file(&quot;quote.txt&quot;);
$today = array_rand($quote, 2);
$msg = $quote[$today[0]];
echo $msg;
?&gt;</pre>
</div>

Sample: <font color=maroon><?php
srand((double)microtime()*1000000);
$quote = file("http://elmblog.com/quote/quote.txt");
$today = array_rand($quote, 2);
$msg = $quote[$today[0]];
echo $msg;
?></font>]]>
      
   </content>
</entry>
<entry>
   <title>Ajaxアプリケーション</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/000972.php" />
   <id>tag:web.elmblog.com,2006:/study//6.972</id>
   
   <published>2006-08-17T14:11:27Z</published>
   <updated>2007-08-08T21:54:40Z</updated>
   
   <summary>ボタンを押すとサーバから取得した文字列をページに表示する簡単なAjaxアプリケーションを試す。 (実践Ajaxアプリケーションを参考にして作成した） 1.JavascriptでXMLHttpRequestオブジェクトを作成するコードを作る。ブラウザがIEならばActiveXオブジェクトとして、それ以外ではJavaScriptオブジェクトとして作成する。 ajax = false; // IE以外 if(window.XMLHttpRequest) { 　　　ajax = new XMLHttpRequest(); // IE用 } else if(window.ActiveXObject) { 　　　try { 　　　　　　ajax = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;); 　　　} catch(e) { 　　　　　　ajax = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;); 　　　} } 2. サーバと通信してデータを取得し、ページを書き換える関数(Ajaxエンジン)を作る。この関数は、第1引数に指定されたURLにアクセスして返された文字列で、第2引数で指定されたIDを持つページ内のオブジェクトの中身を書き換える。 function getData(serverURL, objID)...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[ボタンを押すとサーバから取得した文字列をページに表示する簡単なAjaxアプリケーションを試す。
(<a href="http://www.atmarkit.co.jp/fwcr/special/ajax01/03.html">実践Ajaxアプリケーション</a>を参考にして作成した）

1.JavascriptでXMLHttpRequestオブジェクトを作成するコードを作る。ブラウザがIEならばActiveXオブジェクトとして、それ以外ではJavaScriptオブジェクトとして作成する。
<div class=box><code>ajax = false;
// IE以外
if(window.XMLHttpRequest) {
　　　ajax = new XMLHttpRequest();
// IE用
} else if(window.ActiveXObject) {
　　　try {
　　　　　　ajax = new ActiveXObject("Msxml2.XMLHTTP");
　　　} catch(e) {
　　　　　　ajax = new ActiveXObject("Microsoft.XMLHTTP");
　　　}
}</code>
</div>
2. サーバと通信してデータを取得し、ページを書き換える関数(Ajaxエンジン)を作る。この関数は、第1引数に指定されたURLにアクセスして返された文字列で、第2引数で指定されたIDを持つページ内のオブジェクトの中身を書き換える。

<div class=box><code>function getData(serverURL, objID) {
　　　ajax.open("GET", serverURL);
　　　ajax.onreadystatechange = function() {
　　　　　　if (ajax.readyState == 4 && ajax.status == 200) {
　　　　　　　　　var obj = document.getElementById(objID);
　　　　　　　　　obj.innerHTML = ajax.responseText;
　　　　　　}
　　　}
　　　ajax.send(null);
}
</code>
</div>
3. このJavaScriptを使うHTMLページを作る。ページ内には段落と、Ajaxを実行するためのボタンを1つ配置する。ボタンは通常のsubmit動作は行わずに、JavaScriptの関数を呼び出すだけ。onClickイベントハンドラで指定しているURLは、スクリプトの置かれているURLに置き換える。

<div class=box><code>&lt;html&gt;
&lt;head&gt;&lt;title&gt;最も簡単なAjaxサンプル&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;form&gt;
&lt;input type=button value="取得＆書き換え" onClick="getData('http://www.example.jp/server.php', 'maintext'); return false;"&gt;
&lt;/form&gt;
&lt;div id="maintext"&gt;&lt;p&gt;ボタンを押すとこのテキストが書き換わります。&lt;/p&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code>
</div>
4. サーバ側のスクリプトを作る。サンプルとしてHTMLテキストを返すだけのスクリプトを、クライアント側で指定されている /server.phpとして配置する。サーバ側はPerl、PHP、ASP.NET、J2EEなど、どのような開発環境でも利用できる。
<div class=box><code>&lt;?php
echo '&lt;p&gt;ボタンがクリックされました。&lt;/p&gt;';
?&gt;</code>
</div>
5. これで、ボタンがクリックされるとサーバから取得したデータで、ページ内の指定した部分が書き換えられる。
<script language="JavaScript" src="ajax.js"></script> 
Sample:  <div class=box><code><form>
<input type=button value="取得＆書き換え" onClick="getData('http://web.elmblog.com/study/archives/javascript/ajax.php', 'maintext'); return false;">
</form>
<div id="maintext"><p>ボタンを押すとこのテキストが書き換わります。</p></div>
</div>
<font color=red>【注】phpソースはunicodeで保存しないと文字化けするようだ。<br>ＩＥ６およびＦｉｒｅｆｏｘで正常動作することを確認した。</font>]]>
      
   </content>
</entry>
<entry>
   <title>コメント書き込みの認証</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/movabletype/000959.php" />
   <id>tag:web.elmblog.com,2006:/study//6.959</id>
   
   <published>2006-08-07T19:33:29Z</published>
   <updated>2007-08-08T22:01:36Z</updated>
   
   <summary>Movable Typeでは、スパム防止のために投稿記事にコメントを書き込めるのは、Typekey認証者に限定できる機能がある。 この設定がされているとき、コメントをするためには先ずTypekeyアカウントを作成する必要がある。メールアドレスを持っていれば無料で登録できる。 Movable Typeを使ったブログにコメントを書き込む前に、Typekeyにサインインする。認証されると、コメント投稿フォームの名前、メールアドレスは空白にして、コメントだけを書いて投稿する。名前、メールアドレスを書くとエラーが出るので注意！...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="MovableType" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="27" label="Movable Type" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[Movable Typeでは、スパム防止のために投稿記事にコメントを書き込めるのは、Typekey認証者に限定できる機能がある。

この設定がされているとき、コメントをするためには先ず<a href="https://www.typekey.com/t/typekey/register?lang=ja">Typekeyアカウントを作成</a>する必要がある。メールアドレスを持っていれば無料で登録できる。

Movable Typeを使ったブログにコメントを書き込む前に、Typekeyにサインインする。認証されると、コメント投稿フォームの名前、メールアドレスは空白にして、コメントだけを書いて投稿する。名前、メールアドレスを書くとエラーが出るので注意！]]>
      
   </content>
</entry>
<entry>
   <title>移動する時計</title>
   <link rel="alternate" type="text/html" href="http://elmblog.com/web/study/archives/javascript/000958.php" />
   <id>tag:web.elmblog.com,2006:/study//6.958</id>
   
   <published>2006-08-07T14:26:42Z</published>
   <updated>2007-06-11T13:10:15Z</updated>
   
   <summary> ようこそ、だるまの世界へ Welcome to The Web Dharma 人生は恐れを知らぬ冒険か無か Life is a daring adventure or nothing　 There are three kinds of people; those who make things happen, those who watch things happen, and those who don&apos;t know what the hell is...</summary>
   <author>
      <name>達磨居士</name>
      
   </author>
         <category term="JavaScript" scheme="http://www.sixapart.com/ns/types#category" />
   
   <category term="61" label="JavaScript" scheme="http://www.sixapart.com/ns/types#tag" />
   
   <content type="html" xml:lang="en" xml:base="http://elmblog.com/web/study/">
      <![CDATA[<!--★★★-->
<div class="main-body">
   <p style="padding-top:30px; color:white; font-weight:bold; font-size:28px; margin-bottom: 0;" align="center"><font face="HG丸ｺﾞｼｯｸM-PRO">ようこそ、だるまの世界へ<br>
Welcome to The Web Dharma</font></p>
<br>

   <div align="center" style="font-size : 10pt;font-family : Verdana;color : white;">
<a href="http://home.elmblog.com/">人生は恐れを知らぬ冒険か無か<br>
Life is a daring adventure or nothing</a>　
<br>
<img src="http://web.elmblog.com/study/entry/sunrise.jpg" width="239" height="133"><br>
<script language="JavaScript" src="http://web.elmblog.com/study/entry/clock.js"></script> <br>
      <div align="center" style="width:500px; font-size : 12pt;font-family : Verdana;color : white;">
There are three kinds of people; those who make things happen, those who watch things happen, and those who don't know what the hell is happening.
<br>
      </div>
   </div>

   <div class="main-footer">Copyright &copy;1995-2005 <a href="http://www.elmblog.com/">Elmblog http://www.elmblog.com/</a>
   </div>
         
</div>
<!--★★★-->
]]>
      
   </content>
</entry>

</feed>
