我不知道为什么它不工作。既然它没什么特别的地方,我在网上搜索 - 在这里,但我发现的只有教程没有变量或者问题太具体。Img/Audio通过document.getElementByID(“...”)更改。src = x +“。png”;不会工作
任何人都可以指导我吗?
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function changeaudio(x);
{
document.getElementById("audioplayer").src=x+".mp3";
document.getElementById("image").src=x+".png";
}
</script>
</head>
<body>
<center>
<img id="image" src="1.png">
<audio id="audioplayer" src="1.mp3" controls autoplay loop>
Your browser does not support the audio element.
</audio>
<br>
<input type="button" id="play" value="Play 1" onclick='changeaudio(1)"' />
<input type="button" id="play2" value="Play 2" onclick='changeaudio(2)"' />
<input type="button" id="play3" value="Play 3" onclick='changeaudio(3)"' />
</center>
</body>
</html>
我们不是在这里“指南“你,因为我们不是一个dis理事会。请提出一个具体的编程问题(并确保它将在未来帮助别人!)“不工作”是什么意思?什么_does_发生?在调试过程中发现了什么? –
(本代码中存在基本错别字 - 请在发布之前加倍小心) –
您是对的。当我在将来再次询问这些问题时,我会更具体,并且花更多时间进行调试。希望它可以问:我试着用Firefox进行调试,但我试着让它工作。有人可以推荐一种(简单的,免费的)编辑器和一种“拼写检查”? (使用Notepad ++ atm) – jediotic