0

カレンダーのツールクリップのコードがいくつかあります。ツールチップにhtmlを表示できるようにしたいのですが可能ですか?HTMLを受け入れるように変更しようとするたびにクラッシュし、現在はテキストのみを許可し、HTMLを許可するように変更する方法がわかりません

        <!DOCTYPE html>
        <html>
        <head>
          <meta http-equiv="content-type" content="text/html; charset=UTF-8">
          <title></title>

          <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.2.js'></script>

          <link rel="stylesheet" type="text/css" href="/css/normalize.css">
          <link rel="stylesheet" type="text/css" href="/css/result-light.css">


              <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css">
              <script type='text/javascript' src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>


          <style type='text/css'>
            .pink > a {
            background-color: pink !important;
            background-image:none !important;
        }

        .green > a {
            background-color: green !important;
            background-image: none !important;
        }

          </style>



        <script type='text/javascript'>//<![CDATA[
        $(window).load(function(){
        var Event = function(text, className) {
            // would like to convert this to allow for html
            this.text = text;
            // this.html = text; // does not work
            this.className = className;
        };

        var events = {};
        events[new Date("01/01/2013")] = new Event("New Years Day", "pink");
        events[new Date("12/25/2012")] = new Event("<B>Merry</b> Christmas", "green");

        console.dir(events);

        $("#dates").datepicker({
            beforeShowDay: function(date) {
                var event = events[date];
                if (event) {
                    return [true, event.className, event.text];
                }
                else {
                    return [true, '', ''];
                }
            }
        });
        });//]]>

        </script>


        </head>
        <body>
          <div id="dates"></div>


        </body>


        </html>

あなたが提供するかもしれないコードや助けを前もって感謝します

ジョニー

4

1 に答える 1

0

title 属性では、html コードを使用できません。

しかし、ホバーを変更できるフレームワークがいくつかあります。

jQueryツールチップを使用しました

<script src="http://jquery.bassistance.de/tooltip/jquery.tooltip.js"></script>
$('*').tooltip();

ここでは、ツールチップが変更され、太字が配置されていることがわかります。

http://jsfiddle.net/Morlock0821/WqrMK/

于 2012-12-17T18:34:27.677 に答える