Thin rubber bands work okay, but I find I'm continually adjusting the flashlight's aim as it jiggles around. Jym Dyer recently showed me another cool trick -- using a segment of old inner tube as a quick release for handlebar flashlights. Cut about a six inch strip of inner tube and cut flashlight sized holes at either end of the strip.
Slide one end of the flashlight through one hole, wrap the rubber strip over the top of the handlebar while positioning the flashlight underneath, then secure by sliding the other end of the flashlight through the second hole for a very quick and easy mount for your flashlight.
It doesn't take too much imagination to figure you can do similar mountings around other bike parts if you want, and cheaper than Knog Frogs by far.