我想知道JavaScript是如何使变量在点击时可见的


function myx() {
document.getElementById('poo').style.cssText = 'border-color: rgb(0, 0, 255);color: black;font-size: 20px;padding: 0px;margin: 10px 20px';
document.getElementById("demo").innerHTML = "8300$" (I would like a variable instead of 8300$, like demo + 300)
}

U可以使用模板文字(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals)示例:

document.getElementById("demo").innerHTML = `${demo}300$`;

最新更新