I set the appearance of a textField to 'sunken box'.
Unfortunately, after changing its background-color using the following line of JavaScript code, the 'sunken box' appearance is gone. It's replaced by the 'solid box' appearance.
It's not quite that simple as there's no direct support in the scripting object model for this. When you change those setting in the UI many changes are made to the XML. It makes changes to the border node, as well as the child edge nodes as to whether or not they are present in the XML, as well as modifying attributes on those nodes. You could see what changes are made by looking at the field in the XML source, then changing the appearance in the UI and looking at the new XML, and so on. You'd then have to perform all those changes manually in your script in order to achieve this.