Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 取消按钮在Firefox和Chrome中的行为不同_Javascript_Jsp_Google Chrome_Firefox - Fatal编程技术网

Javascript 取消按钮在Firefox和Chrome中的行为不同

Javascript 取消按钮在Firefox和Chrome中的行为不同,javascript,jsp,google-chrome,firefox,Javascript,Jsp,Google Chrome,Firefox,注意:几个小时前,我也在Javaranch上发布了这个问题。这方面的联系是。 我还没有收到回复。我把它贴在这里,看看能不能得到一两个建议。另外,当涉及到struts和JSP时,我是一个非常初学者,所以如果我需要提供更多细节,请告诉我 ..... some processing and then... <table border="0" class="footerBar"> <tr>

注意:几个小时前,我也在Javaranch上发布了这个问题。这方面的联系是。 我还没有收到回复。我把它贴在这里,看看能不能得到一两个建议。另外,当涉及到struts和JSP时,我是一个非常初学者,所以如果我需要提供更多细节,请告诉我

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
问题是我的网页上的取消按钮在chrome浏览器和firefox浏览器中的行为不同

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
我当前的网址是 上下文路径/importTemployee.do?方法=加载

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
在我的当前页面中,我上传了一个CSV文件。这个页面有两个按钮——ok和Cancel,而这些按钮正是我遇到的问题(稍后我将讨论这一部分)。相关的JSP部分如下所示

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>

....... 一些标题栏和标题栏等等。。。然后如下。
下载文件:
上传CSV文件并单击ok后,将调用相应的action类方法,我的url将更改为- 上下文路径/importTemployee.do?方法=保存

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
此页面基本上包含导入统计信息、未处理记录的错误消息等内容。 此页面还具有“确定”和“取消”按钮。 相应的JSP部分如下所示

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>

/images/new/edge_left.gif“width=“30”
height=“321”alt=”“/>

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
…进行一些处理,然后。。。
因此,如果我在第二个页面(context path/importEmployee.do?method=save)中单击cancel,我将返回到第一个URL页面,即 上下文路径/importTemployee.do?方法=加载。 但这一部分在Firefox和Chrome浏览器中的表现有所不同。 在Chrome中,如果我在第二个页面中单击cancel,我仍然可以在第一个页面中看到上传的文件名(第一个JSP中的隐藏属性是文件名)。如果我单击ok,我可以像第一次在第一个页面上单击ok一样再次进行处理。 但是,当我在Firefox浏览器中运行我的应用程序时,如果我在第二页单击“取消”,上传的文件名会在第一页显示“未选择任何文件”。因此,要再次导入员工,我需要再次上传新的/相同的CSV文件

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
即使在Chrome中运行我的应用程序时,我也不希望在第二页单击“取消”时文件出现在第一页。是的,我要求文件名为隐藏属性。这是因为根据文件中的数据,会进行不同类型的处理,其中一些处理需要从用户处获取额外的输入另一个页面和第三个页面进行处理。因此文件名应该传递到表单中,但我不希望用户再次上传文件

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
但是,如果用户单击“取消”,我不希望文件名保留在第一页中,但这不会发生

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
所以我有两个问题。为什么Chrome和Firefox中的行为不同?我有没有办法纠正Chrome中的行为?

这一问题已经解决

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>
工作人员说,这种取消按钮行为是一种已知的行为。在chrome中单击“取消”后再次看到文件名是可以的。我们不应该在Mozilla中看到它

        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>

很抱歉给您带来困惑,感谢您仔细阅读我的问题。

不确定这是否是浏览器限制,但看起来一定是这样。
        ..... some processing and then...  

        <table   border="0" class="footerBar">  
            <tr>  
                <td id="footerLeft">       
                    <span>   
                        <a class="buttonStyle" href="<%=request.getContextPath()%>/employees.do?method=load"> OK </a>

                    </span>  
                    <input name="cancel" id="cancel" type="submit" class="button" value="Cancel" onclick="goBack(); return false;" />    
                </td>  
                <td id="footerRight" class="pagination">    
                </td>  
            </tr>  
      </table>