Using the prevel framework to add a event is done like below
pl(window).bind("eventname",handlerFunction);
So I did this
pl(window).bind("click", function (ev) {
if (ev.which == 1) {
alert("Clicked");
}
});
On clicking the document or window I was able to alert the string, but heck IE8 does not do the same. Is the Library broken or am I wrong with respect to IE. Prevel Javascript framework can be found here https:开发者_如何学C//github.com/chernikovalexey/Prevel here is the code that should get you working http://jsfiddle.net/pKhHJ/
The code "ev.which" is specific to firefox. For IE you have to use the code as "ev.keyCode". Try the code as shown below
pl(window).bind("click", function (ev) {
if(!ev)
ev = window.event;
var kCode = ev.which || ev.keyCode;
if (kCode == 1) {
alert("Clicked");
}
});
Hope this helps you.
It's fixed already, as I see.
精彩评论