Fix js attachevent error