First of all, document.write() is not an object and a method that are supported in Acrobat JavaScript, only in browsers.
To have text in a text field show up as sub- or superscript you need to use the Rich Text Formatting option. Enable that in your field and then read about the richValue property and how to set it using an array of Span objects. Among the properties of these objects are subscript and superscript.
.
Visit my custom-made PDF scripts website: http://try67.blogspot.com
Contact me personally: try6767@gmail.com