Hello akiloama,
The curly brace you've put at the end of the HTML must be put at the end of the javascript. And 'creat' must be replaced with 'create' everywhere. So your code should look like this:
Javascript:
Code:
window.onload=function(){
var para=document.createElement("p");
var txt=document.createTextNode("hello world");
para.appendChild(txt);
var testdiv=document.getElementById("testdiv");
testdiv.appendChild(para);
}
HTML:
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Test</title>
</head>
<body>
<div id="testdiv">
</div>
<script type="text/javascript" src="scripts/example.js"></script>
</body>
</html>
Bookmarks