var maincontent = document.getElementById("content").innerHTML;
maincontent = "<p>" + first;
On the second line you're overwriting the variable, not setting the .innerHTML
. This is what you want:
var maincontent = document.getElementById("content");
maincontent.innerHTML = "<p>" + first;
Also, you must make sure the elements with ids of "first" "middle" and "last" actually exist, or this might cause a TypeError
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…