Edit in JSFiddle

<body>
<div id="code">
</div>
<input type="button" id="b1" value="Press" onclick="code()">
</body>
function code()
{
var element=document.createElement("code");
var text=document.createTextNode("This is code effect.");
element.appendChild(text);
document.getElementById("code").appendChild(element);
}