关注IE8的问题,提交后控制焦点 [英] Focus problems with IE8, control the focus after a submit

查看:76
本文介绍了关注IE8的问题,提交后控制焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Webdevelop.com上发布了这个问题,如果你已经在那里看到它,请道歉。


I have already posted this question on Webdevelop.com, apologies if you have already seen it there.

大家好所有

我有IE8和Firefox中出现的一个问题。我有一个基于浏览器的应用程序,其中一些JavaScript和服务器对象由ASP控制。应用程序在IE6和IE7中运行良好,我们现在想要转移到IE8和Firefox,其他浏览器(不幸的是,而不是我的决定)将被阻止。

我使用了一种技术,我提交了一个数据库验证的表单,返回时我可能想要打开一个新窗口或刷新并将焦点传递给现有窗口。看来在IE8和Firefox中,如果我想要将焦点传递到的窗口已经打开,焦点将不会完全传递给它,但是窗口在任务栏上的位置会闪烁。奇怪的是,如果在托管应用程序的机器上打开窗口,就不会发生这种情况,这使得调试变得更加困难!

代码如下,任何建议都会受到欢迎。我认为打开的窗口内容(testfocus4.asp)不重要。

FG

将此代码复制到名为testfocus5.asp的文件中>
<%
fFunction = request.form(" frmFunction")
%>

< html>
< head>
< script LANGUAGE =" JavaScript">

var wF2

功能fTestFocus(){
document.f.frmFunction.value = "Test1"
document.f.submit();
在功能fTestFocus2(){
document.f.frmFunction.value =" Test2"
document.f.submit();


fFunction ="<%= fFunction%>" ;;
function init(){
document.f.test1.value = fFunction;
if if(fFunction ==" Test1"){
var var wTF4 = window.open(" TestFocus4 .asp"," TestFocus4","");
wTF4.focus();
}其他{
var var wTF4 = window.open("" ;," TestFocus4","");
wTF4.focus();}

}

WINDO w.onload = init;

< / script>

< / head>
< body>
< form name =" ; F"行动= QUOT; TestFocus5.asp" method =" post">
< input type =" hidden" name =" frmEdit">
< input type =" hidden" name =" frmFunction">
< input type =" text"名称= QUOT; TEST1" value =" 0">
< input type =" text"名称= QUOT;&高效多功能QUOT; value ="<%= fFunction%>">

< p>
< input type =" button"值= QUOT;测试1"名称= QUOT; TestButton1" OnClick =" fTestFocus()">& nbsp;& nbsp;& nbsp;& nbsp;< input type =" button"值= QUOT; Test2的"名称= QUOT; TestButton2"的OnClick = QUOT; fTestFocus2()">&安培; NBSP;&安培; NBSP;&安培; NBSP;&安培; NBSP;
< / p为H.
< /形式>
< ; / body>
< / html>
Hi All

I have a problem which has surfaced in IE8 and Firefox. I have a browser based application with some JavaScript and server objects controlled by ASP. The application ran fine in IE6 and IE7, we now want to move to IE8 and Firefox, other browsers will (unfortunately, and not my decision) be blocked.

I have used a technique where I submit a form for validation by the database, on return I may want to open a new window or refresh and pass the focus to an existing window. It would appear that in IE8 and Firefox if the window I want to pass the focus to is already open the focus will not be fully passed to it, but the window's position on the task bar will flash. Oddly, this will not happen if the windows are being opened on the machine that hosts the application, making it harder to debug!

Code follows, any suggestions would be most welcome. I don't think the contents of the window being opened (testfocus4.asp) are significant.

FG

Copy this code into a file called testfocus5.asp

<%
fFunction = request.form("frmFunction")
%>

<html>
<head>
<script LANGUAGE="JavaScript">

var wF2

function fTestFocus(){
document.f.frmFunction.value = "Test1"
document.f.submit();
}

function fTestFocus2(){
document.f.frmFunction.value = "Test2"
document.f.submit();
}


fFunction = "<% =fFunction %>";

function init(){
document.f.test1.value = fFunction;
if (fFunction == "Test1") {
var wTF4 = window.open("TestFocus4.asp","TestFocus4","");
wTF4.focus();
}
else {
var wTF4 = window.open("","TestFocus4","");
wTF4.focus();
}
}

window.onload=init;

</script>

</head>
<body>
<form name="f" action="TestFocus5.asp" method="post">
<input type="hidden" name="frmEdit">
<input type="hidden" name="frmFunction">
<input type="text" name="test1" value="0">
<input type="text" name="fFunction" value="<% =fFunction %>">

<p>
<input type="button" value="Test1" name="TestButton1" OnClick="fTestFocus()">&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" value="Test2" name="TestButton2" OnClick="fTestFocus2()">&nbsp;&nbsp;&nbsp;&nbsp;
</p>
</form>
</body>
</html>

推荐答案

我有类似的问题。 msdn建议它是IE8的设计并提出了一种方法,但我不能让它工作。
i have a similar issue.  msdn suggests it is by design for IE8 and suggests a method of doing it but i can't get it to work.


这篇关于关注IE8的问题,提交后控制焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆