I am attempting to change the content of a <div> layer by accessing a external html file. Is this possible? I am able to change the content using innerHTML but only from a string or string varible. Please help….
[CODE]<DIV id='myDiv'></DIV>[/CODE]
[CODE]<script> function getHTTPObject(){ var xmlobj; if(xmlobj!=null&&xmlobj.readyState!=0&&xmlobj.readyState!=4){xmlobj.abort();} try{xmlobj=new XMLHttpRequest();} catch(e){try{xmlobj=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){xmlobj=null; return false;}} return xmlobj; } var http = getHTTPObject(); // We create the HTTP Object function handleHttpResponse() { if (http.readyState == 4) { document.getElementById('myDiv').innerHTML = http.responseText; } } function loadPage(sourceURL) { http.open("GET", sourceURL, true); http.onreadystatechange = handleHttpResponse(); http.send(null); } } loadPage('index2.html'); </script>[/CODE]
Help @iceman0 spread the word by sharing this article on Twitter...