Javascript 在Drupal消息框中,为什么关闭按钮在Chrome中不起作用?
这只发生在Chrome中。IE和Firefox工作得很好。在控制台中,我得到一个错误:Javascript 在Drupal消息框中,为什么关闭按钮在Chrome中不起作用?,javascript,drupal-6,Javascript,Drupal 6,这只发生在Chrome中。IE和Firefox工作得很好。在控制台中,我得到一个错误:uncaughttypeerror:object不是函数 它说错误在这里,但我甚至不知道这在哪里: (function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {onclose() };}}}}) 您与该函数名存在某种冲突 尝试: 或者更好: document.getElementById("aerr
uncaughttypeerror:object不是函数
它说错误在这里,但我甚至不知道这在哪里:
(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {onclose()
};}}}})
您与该函数名存在某种冲突 尝试: 或者更好:
document.getElementById("aerror").addEventListener('click', function() {
alert('Hello world');
}, false);
您应该始终使用事件侦听器:您的js中是否有
onclose()
函数?是的,onclose函数存在,在第一行插入了一些javascript(请参见问题中的代码),但我不知道它来自何处。这是由于冲突,因此您最好使用window.onclose()
取而代之!window.onclose()工作正常。谢谢我再过21个小时也不能给赏金了,所以我会尽我所能的。
document.getElementById("aerror").addEventListener('click', function() {
alert('Hello world');
}, false);