How does one use scripting to insert html into rich text fields?

How does one use scripting to insert html into rich text fields?

I'd like to build html code using scripting, then set a rich text field to accept it (RichTextFieldExample = "<html code>";). However, simply submitting it as above doesn't work.  There must be some initial and trailing codes that are expected.  What are these? Thanks,

- David