[英]Permission denied IE8 on jquery keypress (enter)
IE8 keeps throwing error Permission denied : IE8不断抛出错误权限被拒绝 :
(depend on which version I use). (取决于我使用的版本)。
It happens when I press enter ( function on 'Enter' jump around tabindexes). 当我按Enter键时会发生这种情况(“ Enter”键上的功能会在tabindex周围跳转)。 And it happens only on specific server and specific PC group who uses IE8. 而且它仅在使用IE8的特定服务器和特定PC组上发生。
[EDIT] It happens when calling [编辑]通话时会发生
$("[TabIndex='"+tabindex+"']").focus()
$("[TabIndex='"+tabindex+"']").blur()
Full code 完整代码
//WALKING with ENTER
var tabindex = 1; //start tabindex || 150 is last tabindex
$(document).keypress(function(event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13') { //onEnter
if($("[TabIndex='"+tabindex+"']").attr('id') == 'submit_btn'){ //if on 'sbm - button' click!
$("#submit_btn").click();
return false;
};
$("[TabIndex='"+tabindex+"']").blur()//.removeClass('highlight_input');
tabindex++;
//while element exist or it's readonly and tabindex not reached max do
while(($("[TabIndex='"+tabindex+"']").length == 0 || $("[TabIndex='"+tabindex+"']:not([readonly])").length == 0) && tabindex != 150 ){
tabindex++;
}
if(tabindex == 150){ tabindex = 1 } //reseting tabindex if finished
$("[TabIndex='"+tabindex+"']").focus()//.addClass('highlight_input');
return false;
}
});
I can reproduce this error only Logging off/re-logging Windows(XP) -> going back to this interface and pressing 'Enter'. 我只能重现此错误,然后注销/重新登录Windows(XP)->返回此界面并按“ Enter”键。 After F5: everything works fine. F5之后:一切正常。
Has anyone already experienced something like this before? 有人曾经经历过这样的事情吗?
Problem occurred when blur() or focus() ware called, so i had to find workaround. 当调用blur()或focus()软件时出现问题,因此我必须找到解决方法。 Task was to call (almost) pure javascript instead of calling jquery focus/blur. 任务是调用(几乎)纯JavaScript,而不是调用jquery focus / blur。
//Focus workaround for IE8 (exception)
var elid = $('input[tabindex='+tabindex+']').attr("id");
var element = document.getElementById(elid);
element.blur();
var elid = $('input[tabindex='+tabindex+']').attr("id");
var element = document.getElementById(elid);
element.focus();
instead of 代替
$("[TabIndex='"+tabindex+"']").blur()
$("[TabIndex='"+tabindex+"']").blur()
Drop a comment if you have any questions or you have faced the same problem. 如果您有任何疑问或遇到相同的问题,请发表评论。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.