▼入力欄には、入力のヒントとなるテキストが表示されています。このヒントテキストは入力欄をクリックすると消えます。入力欄からフォーカスを外すと、入力欄が空の場合、ヒントテキスト以外のテキストが入力されていない場合、送信後は、再度ヒントテキストが表示されます。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="ja" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="imagetoolbar" content="no" />
<title>ToggleFormText plug-in | 設置サンプル</title>
<link rel="stylesheet" type="text/css" href="/content/lib/global.css" />
<!-- JS -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="/content/lib/jquery/jquery.toggleformtext.js"></script>
<!-- CSS -->
<style type="text/css">
input#username,
input#password { width:10em; }
textarea#comment { width:28em; height:100px; }
</style>
<link rel="stylesheet" type="text/css" href="/common/css/example.css"></head>
<body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
<div id="wrap">
<h1 id='a_toggleformtext'><a href='http://grzegorz.frydrychowicz.net/jquery_toggleformtext/'>ToggleFormText plug-in</a> | 設置サンプル</h1>
<p>▼入力欄には、入力のヒントとなるテキストが表示されています。このヒントテキストは入力欄をクリックすると消えます。入力欄からフォーカスを外すと、入力欄が空の場合、ヒントテキスト以外のテキストが入力されていない場合、送信後は、再度ヒントテキストが表示されます。</p>
<!-- CODE -->
<form action="#" method="get">
<input type="hidden" name="f" value="include/ajax/jquery_plugin_forminput/toggleformtext.inc" />
<input type="hidden" name="ttl" value="ToggleFormText+plug-in%82%CC%90%DD%92u%83T%83%93%83v%83%8B" />
<fieldset>
<legend>コメントを書く</legend>
<p>
<label for="password">ユーザー名</label><br>
<input id="username" name="username" type="text" title="guest" />
<label for="password">パスワード</label>
<input id="password" name="password" type="password" title="guest" />
</p>
<p>
<label for="comment">コメント</label><br>
<textarea id="comment" name="comment" title="コメントを入力してください"></textarea>
</p>
<p>
<input name="Submit" type="submit" value="送信" />
</p>
</fieldset>
</form>
<!-- / CODE -->
</div>
</body>
</html>