add javascript event mechanism