第二个form.submit()在XP的Safari中不起作用,在其他浏览器中也起作用 [英] Second form.submit() doesn't work in Safari on XP, works on other browsers

查看:85
本文介绍了第二个form.submit()在XP的Safari中不起作用,在其他浏览器中也起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您单击页面上的某些内容时,我有一些使用form.submit()打开另一个窗口的代码.它在IE 6-8,Firefox和Chrome和Mac上的Safari中都可以正常运行.但是,在Windows XP的Safari中,单击该按钮后,所有其他执行form.submit()的链接均无效.即使 same 也不起作用.这是该按钮的一些回调代码:

I have some code that uses a form.submit() to open up another window when you click something on my page. It works fine in IE 6-8, Firefox and Chrome, and Safari on Mac. But in Safari on Windows XP, after you click that something, none of the other links that do form.submit() work. Even the same something doesn't do it. Here's some of the callback code for that button:

accessEmployeeViewClicked = function() {
    var form=document.Form<xsl:value-of select="//PAGE/@NAME" />;

    form.action = 'ServletName';
    form.target = "otherTarget";
    form.submit();
};

可以通过以下代码访问该函数:

The function is accessed by the following code:

<a href="#" onclick="accessEmployeeViewClicked();return false;">Access employee's view &gt;&gt;</a>

我在Safari内置调试器中放置了一个断点,第二次单击它时,它肯定会进入 accessEmployeeViewClicked()函数,但会进入 form.submit(); 不执行任何操作.根据评论中的建议,我将form.target更改为"_blank",但没有效果.

I put a breakpoint in the Safari built-in debugger, and the second time you click it, it definitely gets into the accessEmployeeViewClicked() function, but the form.submit(); does nothing. As per the suggestion in the comments, I changed the form.target to "_blank" but that had no effect.

我看过这些类似的问题:

I've looked at these similar questions:

> document.form.submit();不会在野生动物园中提交

并尝试了建议,但没有帮助.

and tried the suggestions, and they don't help.

推荐答案

苹果似乎必须意识到这个问题,因为它于2009年被登录并据称已进入其雷达"错误跟踪系统,但他们不必在意: https://bugs.webkit.org/show_bug.cgi?id=28633

It appears Apple must be aware of the problem, since it was logged in 2009 and supposedly went into their "radar" bug tracking system, but they must not care: https://bugs.webkit.org/show_bug.cgi?id=28633

我从该错误报告中实施了变通方法,并且有效:

I implemented the work-around from that bug report, and it worked:

        form.action = 'ServletName';
        // Work around for Safari bug suggested in https://bugs.webkit.org/show_bug.cgi?id=28633
        if ($.browser.safari)
        {
            form.action += '?t=' + new Date().getTime();
        }
        form.target = "otherTarget";
        form.submit();

这篇关于第二个form.submit()在XP的Safari中不起作用,在其他浏览器中也起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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