Pourquoi -moz-binding ne fonctionne-t-il pas dans mon code ?
Question
j'ai un fichier SolarCalendar.htc
, son contenu est ci-dessous :
<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">
Et j'ai SolarCalendar.htm
fichier qui utilise ce 'SolarCalendar.htc' comme suit :
<!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>
Mais cela ne fonctionne pas dans FireFox (cela fonctionne sur IE).Savez-vous ce qui ne va pas dans ce code ?j'ai utilisé bindings.xml
dans mon projet et des exemples simples fonctionnent bien, mais pas le code ci-dessus.
La solution
Firefox peut-il sélectionner votre élément HTML personnalisé ?
Votre sélecteur pour le <IE:CALENDAR>
le travail des éléments ?Vous pouvez essayer d'utiliser les styles suivants, au lieu du -moz-binding
règle, et voyez s’ils ont un effet :
IE\:Calendar {
width: 100px;
height: 100px;
display: block;
background-color: green;
}
Dans le cas contraire, le sélecteur (IE\:Calendar
) peut être le problème.
Votre nom de fichier est-il correct ?
Voici votre -liaison-moz doubler:
-moz-binding: url(bindings.xml#SolarCalendar.htc);
Si j'ai bien compris, cela dit :
Recherchez le fichier «bindings.xml» et, à l'intérieur, recherchez l'élément avec un
id
attribut deSolarCalendar.htc
.
Si votre fichier s’appelle « SolarCalendar.htc », alors Firefox ne le trouvera pas, car il ne s’appelle pas « bindings.xml ».
Peut-être pourriez-vous retirer le contenu XML de SolarCalendar.htc et l'enregistrer dans un fichier appelé binds.xml ?Puis supprimez #SolarCalendar.htc
de ton -moz-binding
règle?