+=的理解问题
<p id="demo"></p>
<script>
var x = document.getElementById("myBtn");
x.addEventListener("mouseover", myFunction);
x.addEventListener("click", mySecondFunction);
x.addEventListener("mouseout", myThirdFunction);
function myFunction() {
document.getElementById("demo").innerHTML += "Moused over!<br>"
}
function mySecondFunction() {
document.getElementById("demo").innerHTML += "Clicked!<br>"
}
function myThirdFunction() {
document.getElementById("demo").innerHTML += "Moused out!<br>"
}
</script>
上面代码中,+=我的理解是document.getElementById("demo").innerHTML = document.getElementById("demo").innerHTML+"Moused out!<br>";
//设置P标签中的内容,但是我不理解设置document.getElementById("demo").innerHTML有什么作用
这里有什么作用??怎么理解,刚学的菜鸟,求解答~谢谢