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);

如果我理解正确,那就是:

Find the file “bindings.xml”, and within it, find the element with an id attribute of SolarCalendar.htc.

If your file is called “SolarCalendar.htc”, then Firefox won’t find it, because it’s not called “bindings.xml”.

Maybe you could take the XML content out of SolarCalendar.htc, and save it in a file called bindings.xml? Then remove #SolarCalendar.htc from your -moz-binding rule?

于 2012-03-13T08:05:25.443 回答