Emulate some JavaScript commands