我有3个或更多链接。我希望当用户单击其他链接时显示相关视频。
<video id="myVideo" width="1000" height="800" controls autoplay loop>
Your browser does not support the video tag.
</video>
<a onclick="myFunction('VideoConsonants/b.mp4')" style="text-decoration:none">b</a>
<a onclick="myFunction('VideoConsonants/p.mp4')" style="text-decoration:none">p</a>
//there are more links here...//
<script>
function myFunction(str) {
document.getElementById("myVideo").src = str;
document.getElementById("myVideo").load();
}
</script>
但是没有用。如何解决?