made second modification to javascript for error printing (color this time)