为什么我的状态栏上的图标在不同模式下无法更改?
我想问为什么当图标被点击时状态栏中的图标不会改变,而当我点击图标时它应该在关闭模式下改变。
<statusbar id="status-bar">
<statusbarpanel id="inlinetrans-status-bar"
context="inlinetransContextMenu"
onclick="overlay.clickIcon(event)">
<image id="inlinetransIcon" tooltip="inlinetrans versi 1.0" value="on" />
<label value="inlinetrans" />
</statusbarpanel>
</statusbar>
这是我编辑的状态栏的处理程序代码
this.toggle = function(value){
var icon = document.getElementById("inlinetransIcon");
icon.setAttribute("value", value);
this.status = "enable";
if (icon.value == "on")
{
icon.value = "off";
this.status = "disable";
}
else {
icon.value = "on";
this.status ="enable";
}
}
:
this.clickIcon = function(event){
if (event.button == 0)
{
//left button is clicked.
this.toggle(value);
}
}
谢谢您的帮助..
I want to ask why the icon in my status bar does not change when the icon cliked,where as it should change in off mode when I click the icon.
<statusbar id="status-bar">
<statusbarpanel id="inlinetrans-status-bar"
context="inlinetransContextMenu"
onclick="overlay.clickIcon(event)">
<image id="inlinetransIcon" tooltip="inlinetrans versi 1.0" value="on" />
<label value="inlinetrans" />
</statusbarpanel>
</statusbar>
this is the handler code of my statusbar
this.toggle = function(value){
var icon = document.getElementById("inlinetransIcon");
icon.setAttribute("value", value);
this.status = "enable";
if (icon.value == "on")
{
icon.value = "off";
this.status = "disable";
}
else {
icon.value = "on";
this.status ="enable";
}
}
edited:
this.clickIcon = function(event){
if (event.button == 0)
{
//left button is clicked.
this.toggle(value);
}
}
thank you for your help..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您确定您的事件处理程序已被触发吗?
onclick 处理程序调用函数“overlay.clickIcon(...)”,而您的 javascript 定义一个名为“toggle”的方法。
Are you sure your event handler is triggered?
The onclick handler calls the function "overlay.clickIcon(...)" while your javascript defines a method called "toggle".
我找到了我的问题的答案:
i have found the answer of my question :