如果未指定a标签中新页面的目标,则下面的代码将播放声音。但是,我也想在放置目的地时播放声音效果。如何做到这一点?<!DOCTYPE html><html><head><style>nav#nav1{ margin-top: 24px; }nav#nav1 > a{ background:#B9E1FF; color:#000; padding:10px; text- decoration:none; border-radius:5px; font-family:"Arial Black", Gadget, sans-serif; }nav#nav1 > a:hover{ background: #BBEA00; }nav#nav1 > a:active{ background: #EEFFA8; }</style><script>var bleep = new Audio();bleep.src = 'bleep.mp3';</script></head><body><nav id="nav1"><a href="file2.html" onmousedown="bleep.play()">page1</a><a href="#" onmousedown="bleep.play()">page2</a><a href="#" onmousedown="bleep.play()">Services</a><a href="#" onmousedown="bleep.play()">Contact</a></nav></body></html>
添加回答
举报
0/150
提交
取消