好的,这就是我要做的。当我单击另一页面上的按钮时,我希望它将声音发送到本地存储,然后将其发送到播放列表中,以便将其保存到播放列表中。
$('#btn1').on('click', function () {
localStorage.setItem('mallard',"sound/duckcal.mp3");
$("coin").attr('src',"gotit");
});
let gotIt = localStorage.getItem('mallard');
var playlist = document.getElementsByClassName("playlist");
console.log(playlist);
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="call.css">
</head>
<body>
<div class="playlist">
<audio controls id="coin" preload="auto" src=""></audio>
<ul class="onlist">
<li data-id="0" data-audio="">sound</li>
</ul>
</div>
<a href="calls.html" class="back">Back to Calls</a>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="script/animal.js"></script>
<script type="text/javascript" src="script/playlist.js"></script>
</body>
</html>