答案 0 :(得分:1)
我建议使用现有元素,只是更改它的innerText属性。这是一个有效的例子。
function insertAfter(referenceNode, newNode)
{
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
function createText()
{
var selectValue = document.getElementById("money").value;
var CashInput = document.getElementById("cash");
if (selectValue == "pound")
{
var text = "GBP";
} else if (selectValue == "doll") {
text = "USD";
}
document.getElementById("currency").innerText = text;
}
createText();

<select id="money" onchange="createText();">
<option value="pound">England</option>
<option value="doll">USA</option>
</select>
<input id="cash">
<span id="currency"></span>
&#13;