0

I'm attempting to change the innerHTML of a div from the ready function of an iframe's src. Code below. The innerHtml will not change, but the color works fine. Ideas on why this is happening and/or how to fix it?

Page

<html><head></head><body>
<script type="text/javascript" src="Javascript/Import_Subprocess_Content/RAC_Connolly.js"></script>
<div id="importcontent" runat="server">
</div>
<iframe id="frametest" src="./AJAX/Import_Subprocess_Content/RAC_Connolly_ImportSession.aspx">

</iframe>
<div id="popup">FIRST TEXT</div>

</body>

Iframe src

<script type="text/javascript" src="../../Utilities/Javascript/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../../Javascript/Import_Subprocess_Content/RAC_Connolly.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        uploadComplete();
    });
</script>
end it!

js

function uploadComplete() {
    window.parent.document.getElementById("popup").innerHtml = "lala";

}

Testing in IE7 exclusively.

steventnorris
  • 5,656
  • 23
  • 93
  • 174

2 Answers2

0

A workaround you can try:

  1. Transfer uploadComplete method to parent.

    function uploadComplete() {
       document.getElementById("popup").innerHtml = "lala";
       return false;
    }
    
  2. Call this method in your iFrame

    <script type="text/javascript">
    $(document).ready(function () {
        parent.uploadComplete();
    });
    </script>
    

Similar question: Calling a parent window function from an iframe

Community
  • 1
  • 1
Tahir
  • 3,344
  • 14
  • 51
  • 69
0

Capitalization issue. Correct syntax is

document.getElementById("ID").innerHTML = "HTML";

not

document.getElementByID("ID").innerHtml = "HTML";

I was following a fusion of c# and javascript maybe with a VB twist syntax due to switching languages so often. Stupid small errors, big problems.

steventnorris
  • 5,656
  • 23
  • 93
  • 174