I'm trying to make a complex website, and I want to split it into multiple files, one of them is the content itself, and for that I want to make a function that changes a div content from the file.
The entire code :
<html>
<body onLoad = "uploadData();">
<div id = "text"> </div>
</body>
<script>
function uploadData()
{
var file = new File("data");
file.open("r");
var data = "";
while (!file.eof) {
data += file.readln() + "\n";
}
file.close();
alert(data);
document.getElementById('text').innerHTML = data;
}
</script>
</html>
The code has an error at line 7. Please help me !!!