开发者

onClick event does not work with xbl:inherits

I'm developing a Fi开发者_运维技巧refox add-on and having a problem: onClick event does not work with xbl:inherits. Other attributes like value and src work well

Here is my code

Binding:

<binding id="CF-review">
    <content>
        <xul:vbox>
            <xul:label class="CF-review-url" xbl:inherits="onclick">[more]</xul:label>
        </xul:vbox>
    </content>
</binding>

Script:

function onReviewClick()
{
    alert("Something");
}

var elem = document.createElement("vbox");
elem.className = "CF-review";
elem.setAttribute("onclick", onReviewClick);

How can I set event onclick for xul:label element above?


Just a guess, don't know if this would work:

Add a <handler> in your XBL that just calls event.preventDefault if the event.target is anything other than the particular label you want the user to click on. Then when they click on that label, preventDefault won't be called and it will just work, by virtue of the fact that they added an onclick attribute.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜