0

This is only happening in Chrome. IE and Firefox work just fine. In the console I get the error: Uncaught TypeError: object is not a function enter image description here

It is saying the error is here but I don't even know where this is:

(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {onclose()
};}}}})
3
  • do you have that onclose() function in your js ?
    – Bellash
    Apr 21, 2014 at 12:03
  • Yes, the onclose function exists, there is some javascript that is being inserted on the first line (see the code in the question), but I don't know where it's coming from.
    – AllisonC
    Apr 21, 2014 at 12:14
  • It is due to conflicts so you'd better use window.onclose() instead!
    – Bellash
    Apr 21, 2014 at 18:00

1 Answer 1

0
+50

You have some sort of conflict with that function name.

Try:

window.onclose();

Or even better:

document.getElementById("aerror").addEventListener('click', function() {
    alert('Hello world');
}, false);

You should always use event listeners: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener#Why_use_addEventListener.3F

1
  • window.onclose() worked. Thanks! I can't award the bounty for another 21 hours, so I will when I can.
    – AllisonC
    Apr 21, 2014 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.