javascript - IE 8 throwing type mismatch error on replaceChild() -


i'm trying dynamically generate iframe javascript in order keep populating browser history. works in firefox, chrome, , ie9, ie8 throws 'type mismatch' error on replacechild() line. here function i've written:

function frame(ref) {          var iframeheadercell = document.getelementbyid('frame');         var oldframe = iframeheadercell.childnodes[1];          //create new iframe element         var iframeheader = document.createelement('iframe');         iframeheader.src = ref ;         iframeheader.frameborder = 0;          //replace iframe new 1         iframeheadercell.replacechild(iframeheader, oldframe);            return false;     } 

and relevant html:

<a href="#" onclick="return frame('products/embo_balloon.html');" class="product">embo balloon</a>  <!-- dynamically inserted iframe goes inside div --> <div id="frame">      <iframe></iframe>  </div> 

i tried split replacechild() method removechild() , appendchild(), same error appeared on removechild(). made me think maybe 'oldframe' variable root cause of function failing, don't know how. i'll note appendchild() works no problem.

i've seen other people have similar problems unfortunately none applicable situation. i'd happy provide additional information if needed!


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -