Whether your book is hard copy or electronic, it must follow certain guidelines to be considered a published book. In general, these guidelines include a title, copyright notice, introduction, main body, illustrations and an index. It also generally means there is cover art to give the work identity.
To publish a book online you can take an actual, physical book, scan it and save it as a PDF. You then can upload this PDF to a website owned by you, someone else or a digital publisher. Once there, the reader can read it online as a digital book or, if you allow him to, download the file. If the reader downloads the book, usually for a price, this method allows you to control whether the book can only be read on the computer or if it can be printed. Adobe's PDF format allows you to prevent printing and copying.
A digitally published book can be a website itself or part of a website. You can design a website that allows illustrations or photos to accompany different pages and you can place buttons on the website to allow the reader to navigate between the pages.
You can publish virtually anything online. For example, you could publish a collection of photographs, your grandmother's diary of coming to America or your favorite recipes. These can be scattered across various websites, on various pages of one website or as a cohesive whole designed to look like a traditional book.
Digital publishing also can include videos or music. Anytime you upload a video you created to YouTube or another site, you are publishing it for all to see. If you are on MySpace and upload a song you wrote and performed so visitors can listen to it, you are publishing.