金子邦彦研究室プログラミングJavaScript による Web プログラミング強調表示 (jQuery と jQueryUI を使用)

強調表示 (jQuery と jQueryUI を使用)

jQuery UI の

を使って、強調表示す.

◆ 動作画面の例

[image]

関連する外部ページ】 : https://ascii.jp/elem/000/000/498/498710/

準備

◆ JavaScript に関する Web ブラウザの設定


◆ HTML ファイルの例

<?xml version="1.0" encoding="Shift_JIS"?>
<!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; initial-scale=1.0; charset=Shift_JIS" />
        <meta http-equiv="Content-Style-Type" content="text/css" />
        <meta http-equiv="Content-Script-Type" content="text/javascript" />
        <meta http-equiv="MSThemeCompatible" CONTENT="yes" />

        <title>
            強調表示の例
        </title>
      
        <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/base/jquery.ui.all.css" />
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script> 

    </head>

    <body>
    <h1>Highlight / Error</h1>

    <!-- Highlight / Error -->
    <h2 class="demoHeaders">Highlight / Error</h2>
    <div class="ui-widget">
      <div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
        <p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
          <strong>はい</strong> Sample ui-state-highlight style.</p>
      </div>
    </div>
    <br/>
    <div class="ui-widget">
      <div class="ui-state-error ui-corner-all" style="padding: 0 .7em;"> 
        <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span> 
          <strong>Alert:</strong> Sample ui-state-error style.</p>
      </div>
    </div>

    </body>
</html>

実行結果の例

[image]