0

ファイルがありSolarCalendar.htc、その内容は次のとおりです。

<script language="javascript">
//My java Script Code
</script>

<public:property put=fnPutDay                  get=fnGetDay                name="day">
<public:property put=fnPutMonth                get=fnGetMonth              name="month">
<public:property put=fnPutYear                 get=fnGetYear               name="year">
<public:property put=fnPutMonthLength          get=fnGetMonthLength        name="monthLength">
<public:property put=fnPutDayLength            get=fnGetDayLength          name="dayLength">
<public:property put=fnPutFirstDay             get=fnGetFirstDay           name="firstDay">
<public:property put=fnPutGridCellEffect       get=fnGetGridCellEffect     name="gridCellEffect">
<public:property put=fnPutGridLinesColor       get=fnGetGridLinesColor     name="gridLinesColor">
<public:property put=fnPutShowDateSelectors    get=fnGetShowDateSelectors  name="showDateSelectors">
<public:property put=fnPutShowDays             get=fnGetShowDays           name="showDays">
<public:property put=fnPutShowTitle            get=fnGetShowTitle          name="showTitle">
<public:property put=fnPutShowVerticalGrid     get=fnGetShowVerticalGrid   name="showVerticalGrid">
<public:property put=fnPutShowHorizontalGrid   get=fnGetShowHorizontalGrid name="showHorizontalGrid">
<public:property put=fnPutValue                get=fnGetValue              name="value">
<public:property put=fnPutValueIsNull          get=fnGetValueIsNull        name="valueIsNull">
<public:property put=fnPutReadOnly             get=fnGetReadOnly           name="readOnly">
<public:property put=fnPutHoliday              get=fnGetHoliday            name="holiday">

<public:event id="onChange"         name="onchange">
<public:event id="onPropertyChange" name="onpropertychange">
<public:event id="onError"          name="onerror">

そしてSolarCalendar.htm、この「SolarCalendar.htc」を次のように使用するファイルがあります。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html XMLNS:IE>
    <head>
        <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        <STYLE> IE\:Calendar  
            {
                behavior: url(SolarCalendar.htc) ;
                -moz-binding: url(bindings.xml#SolarCalendar.htc);
                 width : 100%; 
             }
        </STYLE>

    </head>
    <body onkeypress="Window_Keypress()" onload="Window_Onload()" onunload="Window_OnUnload()">
        <CENTER><IE:CALENDAR id="cal"></IE:CALENDAR></CENTER>
    </body>
</html>

ただし、FireFox では動作しません (IE では動作します)。このコードのどこが間違っているか分かりますか? 私bindings.xmlは自分のプロジェクトで使用し、それを使用した簡単な例はうまく機能しますが、上記のコードは機能しません。

4

1 に答える 1

0

Firefox はカスタム HTML 要素を選択できますか?

<IE:CALENDAR>要素のセレクターは機能しますか? -moz-bindingルールの代わりに次のスタイルを使用してみて、効果があるかどうかを確認できます。

IE\:Calendar {
    width: 100px;
    height: 100px;
    display: block;
    background-color: green;
}

そうでない場合は、セレクター ( IE\:Calendar) に問題がある可能性があります。

ファイル名は正しいですか?

-moz-binding行は次のとおりです。

-moz-binding: url(bindings.xml#SolarCalendar.htc);

私の理解が正しければ、次のようになります。

ファイル「bindings.xml」を見つけ、その中でid属性がの要素を見つけますSolarCalendar.htc

ファイルの名前が「SolarCalendar.htc」の場合、「bindings.xml」と呼ばれていないため、Firefox はそれを見つけられません。

XML コンテンツを SolarCalendar.htc から取り出して、bindings.xml という名前のファイルに保存できますか? 次に、ルールから削除#SolarCalendar.htcしますか?-moz-binding

于 2012-03-13T08:05:25.443 に答える