▼ul要素内のhelpクラスを指定した要素にマウスオーバーすると、その要素のtitle属性に指定した内容をツールチップ表示します。
マウスオーバーしてください(p要素)
<!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>CoolTips v1.0 | 設置サンプル</title> <script type="text/javascript" src="/content/lib/prototype/prototype-1.5.0.js"></script> <script type="text/javascript" src="/content/lib/scriptaculous_v170/scriptaculous.js?load=builder,effects"></script> <script type="text/javascript" src="/content/lib/cooltips/tooltips.js"></script> <link rel="stylesheet" href="/content/lib/global.css" /> <link rel="stylesheet" href="/content/lib/cooltips/tooltips.css" media="screen" /> <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><a href="http://www.wildbit.com/labs/cooltips/">CoolTips v1.0</a> | 設置サンプル</h1> <p>▼ul要素内のhelpクラスを指定した要素にマウスオーバーすると、その要素のtitle属性に指定した内容をツールチップ表示します。</p> <ul> <li><a href="#" title="a要素のtitle属性に指定した内容をツールチップ表示しています" class="help">マウスオーバーしてください(a要素)</a></li> <li><p title="p要素のtitle属性に指定した内容をツールチップ表示しています。" class="help">マウスオーバーしてください(p要素)</p></li> </ul> <form action="#" method="get"> <fieldset> <legend>登録情報</legend> <p><label for="user_name">名前:</label><input type="text" name="user_name" id="user_name" size="20" maxlength="256" title="あなたの「名前」を入力してください" class="help" /></p> <p><label for="user_age">年齢:</label><input type="text" name="user_age" id="user_age" size="3" maxlength="3" title="あなたの「年齢」を入力してください" class="help" /> 歳</p> </fieldset> </form> <script type="text/javascript"> $$("ul .help").each( function(link) { new Tooltip(link); }); $$("form input.help").each( function(input) { new Tooltip(input, {backgroundColor: "#fc9", borderColor: "#c96", textColor: "#000", textShadowColor: "#fff"}); }); </script> </div> </body> </html>