Can I secure a 12v battery to my bicycle to charge it? And then attach a 12v horn to it? I'm from the Netherlands, so I mean a Dutch style bicycle, as in: 



Then I want to attach a 12 volt horn to it. I could just put it in the basket. It doesn't necessarily need to be charged while pedaling, or it can just be partly charged, but just that it runs out of power a bit slower. Then I'd like to attach a horn to it.

Would this be possible?
I think you're on the wrong track looking at batteries because they're heavy, stealable, fragile, and bad ecologically.

Firstly, you already have an airhorn installed in the middle of your face.  Its steerable so it always sounds in the direction you're looking.
Plus it needs no batteries, and best of all it plays a customised noise, from "OI!" to "LOOK OUT!" to "STOP!"

That was a serious suggestion, but if you want a horn consider an airhorn something like http://deltacycle.com/airzound-horn
It refills from a bike pump and is lighter than a battery, plus no drag from a generator/alternator.

My own experience - I put a small 1.2AH 12V battery inside a disposable 600 ml bottle, and used a small car battery charger to charge it.   I also put a car 12V-->USB adapter in the mouth of the bottle to run my camera and cellphone.  This worked well, but loses a drink cage.

My electric bike has 3x 7AH SLA batteries.  They are in a frame built from light angle aluminium and rivets.  This replaces the main drink bottle cage and works fine, but probably overkill for your requirements.