SoFunction
Updated on 2025-04-10

JavaScript dom append content implementation example


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Unt titled document</title>
<script type="text/javascript">
function util(){
var elm=function(){
return ("testdiv");
}
var createtxt=function(){
var textnode=("test!");
var divnode=("div");
(textnode);
return divnode;
}

=function(){
elm().appendChild(createtxt());
}
}

var c=new util();
setInterval("()",2000);
</script>

</head>

<body>
<div ></div>
</body>
</html>