If you're trying to create a single transportable HTML-like file with images, javascript, CSS, etc. all embedded as multiple "files" then you can try MHTML, which lets you store data of different MIME types in a single file.
It's been supported by IE for some time now, though from experience I can tell you it's somewhat clunky to store, view, and use the files. Generating MHTML programmatically is not too bad though. You basically just create a text file in the specified format and give it a .mht extension, which IE will recognize. URLs can be used to reference and label the different parts (say for including an image in an HTML part), and binary content is stored as base64 encoded text.
Microsoft has a decent example, showing an email message with embedded images, to get you started.
From: [email protected]
To: [email protected]
Subject: An example
Mime-Version: 1.0
Content-Base: http://server.example.com
Content-Type: Multipart/related; boundary="boundary-example-1";type=Text/HTML
--boundary-example-1
Content-Type: Text/HTML; charset=ISO-8859-1
Content-Transfer-Encoding: QUOTED-PRINTABLE
... text of the HTML document, which might contain a hyperlink
to the other body part, for example through a statement such as:
<IMG SRC="/images/image.gif" ALT="Image">
Example of a copyright sign encoded with Quoted-Printable: =A9
Example of a copyright sign mapped onto HTML markup: ¨
--boundary-example-1
Content-Location: /images/image.gif
Content-Type: IMAGE/GIF
Content-Transfer-Encoding: BASE64
AAAFFDDlhGAGgAPEAAP/////ZRaCgoAAAACH+PUNvcHlyaWdodCAoQykgMTk5
NSBJRVRGLiBVbmF1dGhvcml6ZWQgZHVwbGljYXRpb24gcHJvaGliaXRlZC4A
etc...
--boundary-example-1 —