【问题标题】:Firefox not displaying the formFirefox 不显示表单
【发布时间】:2009-06-16 05:32:49
【问题描述】:

我在我的 JSF portlet 中使用 AJAX。当会话到期时,我们假设会收到以下消息(这是会话到期时 AJAX 请求的响应)

此页面用于在您获得请求授权期间保存您的数据。

You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.
<CONTINUE BUTTON>

在 IE 6 和 7 中,我可以看到继续按钮。但在 Firefox 中,我看不到那个按钮。只有文本可见。但在源代码中我可以看到该部分,但在 Firebug 中它是灰色的。我已将屏幕截图上传到http://img31.imageshack.us/img31/619/firefoxcontinue.jpg 理想情况下,它应该自动将用户转发到登录页面,因为 AJAX 无法重定向,它只显示响应。因此,必须在 portlet 中显示继续按钮。谁能告诉我为什么 Mozilla Firefox 中没有显示 HTML 表单。

谢谢

我创建了一个测试页面。当我们尝试在表格中插入表单时,问题就出现了。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <META NAME="Author" CONTENT="">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
 </HEAD>

 <BODY>
 <script type="text/javascript">
    function insertAjax(){
        // alert('inside ajax');
        document.getElementById("wpsportlet").innerHTML='This page is used to hold your data while you are being authorized for your request.<br/><br/>You will be forwarded to continue the authorization process. If this does not happen automatically, please click the Continue button below.<form action="http://www.google.com" method="get" name="AUTOSUBMIT"><input type="submit" value="Continue"/></form>';

    }

 </script>
 <input type=button value="Submit" onclick="insertAjax();">
  <div id="wpsportlet">


  </div>
 </BODY>
</HTML>

如果我将表单嵌套在表格中,则表单不会在 Firefox 中显示。有人可以帮忙解决这个问题吗?

【问题讨论】:

    标签: ajax firefox jsf


    【解决方案1】:

    您生成的 DOM 无效。字符数据(文本)和

    【讨论】:

      【解决方案2】:

      当响应显示在屏幕上时,为什么不使用 JavaScript 添加一个按钮?
      这种方式应该适用于所有浏览器...

      function addButton() {  
          //Create an input type dynamically.  
          var element = document.createElement('input');  
      
          //Assign different attributes to the element.  
          element.setAttribute('type', 'button');  
          element.setAttribute('value', 'Continue');  
          element.setAttribute('name', 'somename');  
          element.setAttribute('id', 'someid');  
      
          var foo = document.getElementById("fooBar");  
      
          //Append the element in page
          foo.appendChild(element);  
      } 
      

      【讨论】:

      • 感谢您的回复 Dror。问题是会话过期时会显示上述消息(来自外部安全管理器-sitemeinder)。否则会显示一些搜索结果。我需要检查响应是否包含某些字段,然后按照您的说明附加元素。但这会使应用程序与 SiteMinder 紧密绑定。
      • 表格里面没有显示表格的原因是我们没有tr和td标签。如果我添加这些标签,表单就会显示出来。
      • 很高兴听到你解决了这个问题 - 写下你的答案并接受它以供其他可能需要你解决方法的人参考。
      猜你喜欢
      • 2013-05-15
      • 1970-01-01
      • 1970-01-01
      • 2014-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多