鼠标划过链接发出声音

  今天突发奇想 想把有链接的地方鼠标划过有声音出来。。。。结果很OK  搞定 

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>鼠标划过链接发出声音</title>
    <style>
        a {
            color: blue;
            text-decoration: none;
        }
    </style>
    <script>
        var audio = new Audio(); // 创建一个 Audio 对象
        audio.src = "link-hover-sound.mp3"; // 设置音频文件路径
        function playSound() {
            audio.play(); // 播放音频
        }
    </script>
</head>
<body>
    <a href="https://365.tf/" target="_blank" onmouseover="playSound()" >365博客这是一个链接</a>
</body>
</html>

查看演示  https://365.tf/assets/file/zp/20230330093943.html

2023-03-30 09:40:21 通过 网页 浏览(656)

共有0条评论!

发表评论

更换一道题!