iframe no loading in IE with javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pedrogameiropinto
    New Member
    • Feb 2008
    • 2

    #1

    iframe no loading in IE with javascript

    IE seems to behave badly with iframe reloading in javascript.
    The code below works fine in firefox but doesn't in IE.
    The code loads some document into an iframe whenever we press the button.
    The question is how do I make this code behave in IE?


    [HTML]<script type="text/javascript">
    function GetFile(url)
    {
    document.getEle mentById("IFram eGetFile").src = url
    }
    </script>
    [/HTML].
    .
    .
    [HTML]<button id="btnGetFile " name="btnGetFil e" onclick="GetFil e('ATableExcell .asp')" value="GetFile" >Get File</button>
    <iframe id="IFrameGetFi le" name="IFrameGet File" src="" />[/HTML]
    Last edited by acoder; Feb 7 '08, 12:18 PM. Reason: Added code tags
  • pedrogameiropinto
    New Member
    • Feb 2008
    • 2

    #2
    I solved the problem. Reload the IFrame with this code instead (it works in IE 6.0 and firefox)

    frames['IFrameGetFile'].location.href = url

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Hi, welcome to TSDN!

      Glad you managed to fix it, but it should've worked - see this link.

      Comment

      Working...