Typeerror: Value Does Not Implement Interface Eventlistener
This works find in IE and Chrome, however, in Firefox, I get the error: 'TypeError: Value does not implement interface EventListener.' This code is posted by a php script, so I had
Solution 1:
if (…) {
function …() {
…
}
}
is invalid. Function declarations must be on the top level of function or program bodies, inside of blocks their behaviour is implementation-dependent. Move it outside the if-statement:
functionLogout() {
var just_logged_out = 1;
window.location.href = "logout-redirect.php";
}
if (document.getElementById("Logout") != null) {
varLogout_Link = document.getElementById("Logout");
Logout_Link.addEventListener('click', Logout, true);
}
So if the function was not declared [correctly], what's that odd error message? You might've expected something like WRONG ARGUMENTS ERROR: handler is 'undefined'
. But actually it's not, Logout
does refer to your link element. And that does indeed not implement the EventListener
interface (JavaScript functions do).
Post a Comment for "Typeerror: Value Does Not Implement Interface Eventlistener"