如何将的整个区域设为在 XUL 中可点击?
尝试学习一些 XUL,但有点卡住了。首先建立一个非常基本的专辑列表。
假设我有这个框 - 歌曲列表开始隐藏,但我想在单击主 albuminfo
框时显示它。
<box align="left" class="album" id="test" orient="vertical">
<box class="albumInfo" ><description value="Album 1" class="albumName"/><label class="albumArtist" value="Album artist 1"/></box>
<box><label value="Year of release"/><label value="Genre"/></box>
<listbox align="left" class="songlist" collapsed="true">
<listitem label="Song 1"/>
<listitem label="Song 2"/>
<listitem label="Song 3"/>
<listitem label="Song 3"/>
<listitem label="Song 5"/>
</listbox>
</box>
单击整个 albuminfo
框区域时如何触发 Javascript 命令?我可以很好地使用按钮,但我真的想让整个框区域都可单击。
Trying to learn a bit of XUL but am a bit stuck. Building a very basic album list to start.
So say I have this box - the song list starts hidden but I want to show it when I click on the main albuminfo
box.
<box align="left" class="album" id="test" orient="vertical">
<box class="albumInfo" ><description value="Album 1" class="albumName"/><label class="albumArtist" value="Album artist 1"/></box>
<box><label value="Year of release"/><label value="Genre"/></box>
<listbox align="left" class="songlist" collapsed="true">
<listitem label="Song 1"/>
<listitem label="Song 2"/>
<listitem label="Song 3"/>
<listitem label="Song 3"/>
<listitem label="Song 5"/>
</listbox>
</box>
How can I fire a Javascript command when I click the entire albuminfo
box area? I can use a button just fine, but I really want to make the entire box area clickable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 XUL 中通过多种方式完成此操作。既然您要求通过单击按钮来实现这一点,那么您就可以:
当您单击按钮时,您将获得专辑信息!
如果没有,您可以使用此选项,当您单击框上的任意位置时,列表框将打开,只需稍微更改上面的内容即可。
您可以通过多种方式操作列表。如需更多参考,请查看此链接:https://developer.mozilla.org/en/XUL_Tutorial/Manipulated_Lists
you can do it many ways in XUL. SInce you asked a simple way doing it by clicking a button, here you go:
When you click the button you will get your Album Info!!!
If not, you can use this option, when you click anywhere on the box, you listbox will open, by changing above slightly.
You can manipulate list in many ways. For more reference please check this link: https://developer.mozilla.org/en/XUL_Tutorial/Manipulating_Lists
用户可以通过多种方式触发XUL中的
command
事件。例如:用鼠标单击元素,当焦点位于元素上时按默认热键(Space 或 Enter 按钮),单击元素的标签,按元素或元素标签的访问键。从您的问题的声音来看,您实际上只对元素本身上的鼠标单击感兴趣,并且不需要command
事件提供的所有其他可访问性。这意味着您可以简单地监听click
事件:例如,如果单击元素,您可以触发现有的
元素:The user can trigger the
command
event in XUL by multiple means. For example: click the element with the mouse, press a default hotkey (Space or Enter for a button) when focus is on the element, click the element's label, press the element's or element label's access key. From the sound of your question, you are really only interested in mouse clicks on the element itself and you don't need all the additional accessibility provided by thecommand
event. Which means that you can simply listen to theclick
event:You could for example trigger an existing
<command>
element if the element is clicked: