admin管理员组文章数量:1400157
I'm using an Infragistics grid on a form and am handling multiple client-side events on the cells (e.g. cell click, before cell edit, before cell update, etc).
On the cell click event, I'm spawning a secondary window (successfully) as follows:
var convChartWindow = window.open("conversioncharts/" + currentCell.getValue() + ".html", "chart", "location=0,0, status=1, scrollbars=1, width=" + screen.width + ", height=175");
convChartWindow.focus();
However, the convChartWindow
does not maintain the focus, and gets covered with the parent window. None of my other cell events fire after this, but there seems to be some Infragistics JavaScript that runs.
Is there a something I can put after the .focus()
above to prevent further JavaScript from running and keep the focus on the correct window?
I'm using an Infragistics grid on a form and am handling multiple client-side events on the cells (e.g. cell click, before cell edit, before cell update, etc).
On the cell click event, I'm spawning a secondary window (successfully) as follows:
var convChartWindow = window.open("conversioncharts/" + currentCell.getValue() + ".html", "chart", "location=0,0, status=1, scrollbars=1, width=" + screen.width + ", height=175");
convChartWindow.focus();
However, the convChartWindow
does not maintain the focus, and gets covered with the parent window. None of my other cell events fire after this, but there seems to be some Infragistics JavaScript that runs.
Is there a something I can put after the .focus()
above to prevent further JavaScript from running and keep the focus on the correct window?
4 Answers
Reset to default 4Call this:
// Prevents event bubble up or any usage after this is called.
// pE - event object
function StopEvent(pE)
{
if (!pE)
if (window.event)
pE = window.event;
else
return;
if (pE.cancelBubble != null)
pE.cancelBubble = true;
if (pE.stopPropagation)
pE.stopPropagation();
if (pE.preventDefault)
pE.preventDefault();
if (window.event)
pE.returnValue = false;
if (pE.cancel != null)
pE.cancel = true;
} // StopEvent
This was snipped from here: What is equivalent of 'event.returnValue=false' in Firefox
and was written by Peter Blum
See: PeterBlum.
i dont know what infragistics is. ill assume its some framework over which you have no control. if i were you i would try the following:
1) set a timeout to take focus back to the window after 1000 ms, or set a timeout loop to set focus to the window you need. this is a hack.
2) figure out what functions fire the events that ruin your life, override those functions in your code and add a flag that will prevent them from doing something evil
3) last, atleast read this: http://www.quirksmode/js/events_order.html there might be something useful for you in there
Have the child window call the focus itself when it opens.
If there is something else in the function that runs the code you gave, try using:
break;
after:
convChartWindow.focus();
本文标签: aspnetHow to stop further JavaScript events from executingStack Overflow
版权声明:本文标题:asp.net - How to stop further JavaScript events from executing - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744254539a2597413.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论