此示例来自this Mozilla's page。为什么这个XBL示例不起作用?
main.xul
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="main.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<box id="num" class="labeledbutton" title="Number of Things:" value="52"/>
<button label="Show" oncommand="document.getElementById('num').showTitle(true)"/>
<button label="Hide" oncommand="document.getElementById('num').showTitle(false)"/>
</window>
的main.css
box.okcancelbuttons {
-moz-binding: url('main.xml#labeledbutton');
}
main.xml中
<?xml version="1.0"?>
<binding id="labeledbutton">
<content>
<xul:label xbl:inherits="value=title"/>
<xul:label xbl:inherits="value"/>
</content>
<implementation>
<method name="showTitle">
<parameter name="state"/>
<body>
if (state) document.getAnonymousNodes(this)[0].
setAttribute("style","visibility: visible");
else document.getAnonymousNodes(this)[0].
setAttribute("style","visibility: collapse");
</body>
</method>
</implementation>
</binding>
为什么不显示当我点击按钮框?
酷!这个例子应该是这样清楚的。谢谢! – 2010-09-13 15:01:53
@TomBrito,你知道,你可以编辑它;) – batman 2013-07-09 14:34:38