Use javascript to handle register actions.