时间: 2021-07-31 作者:daque
而后咱们设置calendar自设置标志: <public:component tagname="calendar"> <attach event="oncontentready" onevent="fninit()"/> </public:component> public:component用来刻画calendar标志,在发端和中断标志之间,您不妨将事变附加到calendar标志上,事变oncontentready将在calendar.htc文献十足被导出,并被领会时,指定处置功夫的是设置在javascript的因变量:fninit():<script language="javascript"> <!-- function fninit() { defaults.viewlink = document; } // --> </script> viewlink指定的值特殊要害,它是html组件的普通,它贯穿了html组件和挪用该html组件的页面,defaults东西有其余属性而且会在其余场合被掩盖,咱们给viewlink属性赋的是html文书档案东西,正由于该贯穿,咱们才不妨创造htc组件和包括页面互访。 咱们将在反面证明日历的层。提防,纵然在日历中当月确当天框和其余天框、空框的款式不一律,然而咱们经过优先级规则来实行在包括页中,html组件忽视任何彼此辩论的款式设置。calendar.htc的款式设置如次: <style> td { background-color:tan; width:50; height:50; } </style> 此刻将该设置和日历比拟,惟有空框是的脸色是黄褐色的,咱们挪用的htc忽视了那些设置,被挪用的页面都嵌入了页面定制。以次挪用today:day html组件:<today:day value=' + dayofmonth + '></today:day> 咱们不过大略的传入了当月中的第几天,同样的挪用anyday:day 也是大略的传入当月中的第几天: <anyday:day value=' + dayofmonth + '></anyday:day>