▼入力欄にフォーカスを当てると、クリックした入力欄がハイライト表示されます。
<!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>focus fields| 設置サンプル</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.focusfields.js"></script> <script type="text/javascript"> $(function(){ $("#exp1 input, #exp1 textarea").focusFields(); $("#exp2 input, #exp2 textarea").focusFields("#f0f"); $("#exp3 input, #exp3 textarea").focusFields(null, 6) $("#exp4 input, #exp4 textarea").focusFields(null, null, "#598f8f", "#fff") }); </script> <!-- CSS --> <style type="text/css"> textarea, input { border:1px solid #ccc; background:#fff; width:20em; } </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><a href='http://www.texotela.co.uk/code/jquery/focusfields/'>focus fields</a> | 設置サンプル</h1> <p>▼入力欄にフォーカスを当てると、クリックした入力欄がハイライト表示されます。</p> <!-- CODE --> <form action="#"> <h2>例1:デフォルト</h2> <pre>$("#exp1 input, #exp1 textarea").focusFields();</pre> <div id="exp1"> <p><textarea>テキストエリア</textarea></p> <p><input type="txt" value="テキスト入力フィールド" /></p> </div> <h2>例2:枠線色を「#f0f」にする</h2> <pre>$("#exp1 input, #exp1 textarea").focusFields("#f0f");</pre> <div id="exp2"> <p><textarea>テキストエリア</textarea></p> <p><input type="txt" value="テキスト入力フィールド" /></p> </div> <h2>例3:枠線の太さを6pxにする</h2> <pre>$("#exp2 input, #exp2 textarea").focusFields(null, 6)</pre> <div id="exp3"> <p><textarea>テキストエリア</textarea></p> <p><input type="txt" value="テキスト入力フィールド" /></p> </div> <h2>例4:背景色を「#598f8f」にし、文字色を「#fff」にする</h2> <pre>$("#exp3 input, #exp3 textarea").focusFields(null, null, "#598f8f", "#fff")</pre> <div id="exp4"> <p><textarea>テキストエリア</textarea></p> <p><input type="txt" value="テキスト入力フィールド" /></p> </div> </form> <!-- / CODE --> </div> </body> </html>