Here's how you can make it, bear in mind that depending on how big your pool or moat will be you may need a lot of buckets of water or lava!
First you need to dig a hole, or create a raised wall 1 block high to contain the lava.
Dig a 2 block deep line for where you want your bridge to be and place sticky pistons all the way down it, facing upwards. Dig another 2 block wide, 2 block deep line to the side of the pistons, this is where your wiring will be.
Make sure that the pistons raise and lower when you pull the lever and then cover up the wiring. The blocks over the sticky pistons need to be a non flammable material such as stone.
Now you are ready to fill up the hole with lava or water, and you will be able to raise and lower your bridge to get across.
FIRE SAFETY TIP!
Never trust Minecraft pig with lava or fire, or any means of creating a fire, because this will happen!