2013-12-12 33 views
0

嗨我有一個腳本的問題。我認爲這與位置有關......在所有瀏覽器中都能正常工作。但是,當此腳本運行在Facebook應用程序(Iframe)中時,它不會在Internet Explorer中觸發函數postbackhiddenfield。它在所有其他瀏覽器中都有...JavaScript不工作在Facebook應用程序(Iframe)

有人提示嗎?

<html xmlns="https://www.w3.org/1999/xhtml"> 
<head id="Head1" runat="server"> 
    <title></title>  
     <script type="text/javascript"> 
     // Changing the value of the hidden field forces the page to postback 
     // and executes the hdnUpdater_ValueChanged() procedure on the code behind 
     function postBackHiddenField(hiddenFieldID) { 
      //var hiddenField = $get(hiddenFieldID); 
      var hiddenfield = document.getElementById(hiddenFieldID) 
      if (hiddenField) { 
       hiddenField.value = (new Date()).getTime(); __doPostBack(hiddenFieldID, ''); 
      } 
     } 
    </script> 

</head> 


<body> 
    <form id="form1" runat="server"> 

    <!-- The acess_token is stored...//--> 
     <asp:HiddenField ID="hdnAccessToken" runat="server" /> 
     <!-- The control that postbacks the access_token...//--> 
     <asp:HiddenField ID="hdnUpdater" runat="server" /> 
     <!-- The script that grabs the access_token in the hash, stores the access_token in the 
        'hdnAccessToken', and postbacks the value for JSON retrieval and decoding...// 
     window.frameElement.contentWindow.location.hash    
      --> 
    <script type="text/javascript"> 
     if (window.location.hash.length != 0) {    // Check if there's a hash on the URI 
     accessToken = window.location.hash.substring(1); // Retrieve the access_token 
     document.getElementById('hdnAccessToken').value = accessToken; // Store the access_token 
     //postBackHiddenField('hdnUpdater');    // Postback the page 
     __doPostBack('hdnUpdater', '') 
     } 
     </script> 
    </form> 
</body> 

回答

0

你改變:的document.getElementById( 'hdnAccessToken')值=的accessToken。

document.getElementById('<%= hdnAccessToken.ClientID %>').value = accessToken; 
相關問題