我正在使用此功能来播放一些嵌入的 wav 文件。
function playnote(note) {
document.embeds[note].play();
}
单击调用此函数的按钮后,我得到表达式 undefined is not a function 的结果
我应该使用“Play”,它会起作用! :)
最佳答案
将其粘贴到 playnote()
的开头。如果您使用 Firebug,console.debug
是 alert
的更好替代品。
alert(document.embeds);
alert(document.embeds[note]);
我打赌第二个警报将产生未定义
。 JavaScript 无法调用 undefined
上的方法。显然 embeds
数组/对象不包含 note
的索引/字段。
关于javascript - 表达式未定义的结果不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6407604/