allocate event by js