troubleshooting Question

window.frames.tk.document.getElementById("theBody") has no properties

Avatar of arjen
arjen asked on
JavaScript
8 Comments1 Solution222 ViewsLast Modified:
window.frames.tk.document.getElementById("theBody") has no properties

is the error I get form the this code if a url is loaded with a ?. e.q. index.html?somepage.html.

The call index.html page has:
<body id="indexpagina" onload="start()">

<iframe name="tk" id="tekstkolom" width="0" height="0" frameborder="0" src=" "></iframe>
.......

and the code in somepage.html is
<body id="theBody">
.......

function start(){
  welkepagina();
}

function welkepagina(){                                                       // pagina achter index.html? laden
  var laadpagina = window.location.search.slice(1);
  if (laadpagina.length>0){
    var URLoud = laadpagina.lastIndexOf("URL");                         // externe verwijzingen met URL variabele naam van oude pagina.
    if (URLoud > 0) {laadpagina = laadpagina.slice(0,-3)+".html";}
    loadpage('kolommidden',laadpagina);
     }
}

function loadpage(id,url) {
  if ((typeof document.getElementById != "undefined") &&             // W3C standards-compliant browser code
     (typeof document.body.innerHTML != "undefined")){                // ondersteunt ook de niet standaard innerHTML
    document.getElementById('tekstkolom').src = url;
    showpage(id);}
  else{                                                                           // browser ondersteunt niet de standaarden, laad pagina op normale wijze
    window.location=url;          
     }
}

function showpage(id) {
  document.getElementById(id).innerHTML = window.frames.tk.document.getElementById('theBody').innerHTML;
}


clearly the element 'theBody' is not yet loaded. But how can I wait until the 'theBody' element is loaded?
ASKER CERTIFIED SOLUTION
knightEknight

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros