EDITABLE CODE:
LiveDemo: JavaScript String Object : Methods
Note:Its always better to use CSS or JavaScript style property.