function sample1Func(text) { var text = document.createTextNode(text); var sample1p = document.getElementById("sample1p"); sample1p.appendChild(text); }
var sample2Btn = document.getElementById("sample2Btn"); sample2Btn.onclick = function sample2Func(){ var sample2Txt = document.createTextNode("sample2"); var sample2p = document.getElementById("sample2p"); sample2p.appendChild(sample2Txt); }
---
function sample3Func(){ var sample3Text = document.createTextNode(""); sample3Text.nodeValue = "node更新"; var sample3p = document.getElementById("sample3p"); sample3p.appendChild(sample3Text); }
function s4Func(s4Str){ var s4Div = document.getElementById("s4Div"); s4Text = document.createTextNode(s4Str); s4Div.innerText = s4Str; }