You can't create an animated jpg, only an animated GIF. I would strongly suggest NOT trying to code this yourself unless you're a very good programmer. It would require building a GIF file by hand which means understanding the headers involved and how the bytes of the data work for the image.
You might be able to find a control that helps you with some of this. But, if you really just want to create an animated gif and not write a program that does it, I'd suggest finding a utility to do it. I use Paint Shop Pro's Animation Studio (last copy I bought was around $80 for both PSP and the Animation Studio). I'd bet a dollar there are some free animated gif builders available if you search google. They normally work by having you add a bunch of individual gif files and then tweaking the speed of each frame and a few other parameters.
-Ner