I am not a lawyer and I cannot give legal advice. If you have serious concerns, consult a lawyer. However, I will share the following information, which you should confirm with a lawyer if you wish to pursue any kind of legal action.
Copyright is automatic, and has been since 1989. You do not need to take any special steps to be the sole legal owner of your own work. However, there are certain legal benefits to be obtained by registering your copyright with your national government. At the very least, it will of course be easier to prove that the work is your own if it contains a copyright notice or other clear assertion that the work was created by and belongs to you. For example, this web page is Copyright 2003, Boutell.Com, Inc.
Protecting images from theft is an interesting challenge; no method is 100% effective, but it is possible to "watermark" your images to ensure that you can prove that they were stolen. For more information, see the entry on protecting your images.
A copyright is not the same thing as a patent. For instance, a patent might cover a general method for creating popup menus; but your copyright extends only to a particular piece of Javascript source code, or to the appearance and content of your popup menus. While copyright is automatic, patents are granted by the government at the end of a lengthy and sometimes expensive process. Patents on software programming ideas, especially relatively simple ideas, have a generally negative impact and have recently been awarded far too frequently for unoriginal "inventions."
Short pieces of Javascript or HTML code and general web design techniques are not something you can realistically protect and prevent others from copying, and I do not recommend that you attempt to do so. On the other hand, you may certainly pursue legal action if others steal your images or text.
Copyright can be a very powerful tool. Although the most common copyright "license statement" is the familiar phrase "All Rights Reserved," you can choose to grant or deny others the right to use your work in particular ways or for particular purposes. For instance, the "Artistic License" covers the Perl programming language interpreter, and the GNU General Public License covers the Linux operating system kernel. Both of these licenses allow third parties to use the work of the original artist very freely; however, if a third party makes changes to the work, the GNU General Public License requires those changes to be released under the very same license -- and shared with the world, just like the original work. It is also common to see licenses that grant free use for noncommercial purposes only.