我正在尝试理解JS引用。
<a id="ohnoes" href="https://www.kasandbox.org/programming-sounds/rpg/giant-no.mp3">What does Oh Noes say?</a>`
所以我在这个函数中引用了上面的标记:
var ohnoesEl = document.getElementById("ohnoes");
var onOhNoesClick = function(e) {
e.preventDefault();
var audioEl = document.createElement("audio");
audioEl.src = "https://www.kasandbox.org/programming-sounds/rpg/giant-no.mp3";
audioEl.autoplay = "true";
document.body.appendChild(audioEl);
};
为什么这样做:
audioEl.src = "https://www.kasandbox.org/programming-sounds/rpg/giant-no.mp3";
但不是这样:
audioEl.src = ohnoesEl.href;
答案 0 :(得分:1)
您好,我刚刚测试了您的代码,结果发现href工作正常。
The type name 'EmployeeReference' does not exist in the type 'HRMS'