View source does not show elements which were added by javascript to the DOM
Hi Everyone,
Does anyone know why the elements which were added to the DOM by java script are not available when I try to view source? The element were there but are missing when try to view source.
thanks,
Jdang
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<input type="button" id="myButton" onclick=TestFunction() value="Click Me"/>
</body>
</html>
<script type="text/javascript">
document.body.appendChild(NewDiv("div01", "Hello...."));
function NewDiv(id, text) {
var myDiv = document.createElement("Div");
myDiv.id = id;
myDiv.innerHTML = "<H3>" + text + "</h3>"
return myDiv;
}
function TestFunction() {
var obj = document.getElementById("div01");
if (obj != null) {
alert(obj.innerHTML);
}
}
</script>