我需要此功能的全部功能,但我似乎忘了如何將多個JavaScript文件連接到一個功能。 這裏是我的index.html自定義HTML5 Mp3播放器
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
source src="/storage/
emulated/0/Documents/
Mp3Player/js/
MyScript.js"></script>
<script type="text/javascript"
source src="/storage/
emulated/0/Documents/
Mp3Player/js/MyScript1.js"></
script>
</head>
<body>
<img src="/storage/emulated/0/
Documents/Mp3Player/html/
images/play.jpg" width="200"
height="200" onclick="play();
changeImage();">
<audio id="audio" src="/storage/
emulated/0/Documents/
Mp3Player/html/music/
Rap_In_Darkness.mp3 "/>
</body>
</html>
這裏的MyScript.js的音頻播放。
function play(){ var myAudio =
document.getElementById
("audio"); if(myAudio.paused)
myAudio.play(); else
myAudio.pause(); }
這裏是暫停/播放按鈕圖像的MyScript1.js。
function changeImage() { if
(document.getElementById
("imgClickAndChange").src == "/
storage/emulated/0/
Documents/Mp3Player/html/
images/Pause.jpg") {
document.getElementById
("imgClickAndChange").src = "/
storage/emulated/0/
Documents/Mp3Player/html/
images/play.jpg "; } else {
document.getElementById
("imgClickAndChange").src = "
storage/emulated/0/
Documents/Mp3Player/html/
images/Pause.jpg "; } }
@MoinuddinQuadri能你解決這個問題我想知道你是否記得如何將多個.js文件鏈接到一個html,而不會造成混亂 –