addListener function to support IE8's attachEvent