What is wrong with this function? The first if-statement does work. But the else-statement doesn't work.
function func() {
if (document.getElementById("pic2").src = "pause.png") {
document.getElementById("pic2").src = "play.png";
} else {
document.getElementById("pic2").src == "pause.png";
}
}
HTML:
<div id="all" onclick="func()" onmouseover="func3()">
<div id="background" onclick="func()" onmouseout="func2()"></div>
<div id="pic">
<img id="pic2" src="pause.png">
</div>
<video>
<source src="test.mp4" type="video/mp4">
</video>
</div>
Aucun commentaire:
Enregistrer un commentaire