UPDATE:
From your question and from what you say in the comment. i assume you have a scenario like this:
- you have a file with some information.
- you want populate your div with theese information.
so before going further create a well formatted file to store all the info. example
<?xml version="1.0" encoding="UTF-8"?>
<data>
<div>
<h2>lorem ipsum</h2>
<p>brown fox jump hover the lazy dog</p>
</div>
<div>
<h2>lorem ipsum 1</h2>
<p>brown fox jump hover the lazy dog 1</p>
</div>
</data>
then use AJAX to load the content and append it to the wanted element like below
<html>
<head>
<title></title>
<script>
var descriptor;
function init() {
descriptor = document.getElementById("descriptor");
loadFromFile('data.xml');
}
function loadFromFile(thisfile) {
var xmlhttp;
if(window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var data = xmlhttp.responseXML.documentElement.getElementsByTagName('div');
var divs = '';
for(var i = 0; i < data.length; i++) {
var div = data[i];
divs += '<div>';
divs += '<h2>' + div.getElementsByTagName('h2')[0].firstChild.nodeValue + '</h2>';
divs += '<p>' + div.getElementsByTagName('p')[0].firstChild.nodeValue + '</p>';
divs += '</div>';
}
descriptor.innerHTML = divs;
}
}
xmlhttp.open("GET", thisfile, true);
xmlhttp.send();
}
</script>
</head>
<body onload="init()">
<div id="descriptor"></div>
</body>
</html>