Do some research e.g. read Codeproject articles such as this one Paint Brush Application Using HTML5 Canvas
] (there are others in CodeProject and even more can be found via Google).
Have a go yourself (it's probably not as hard as you think). If you hit problems then come back and post a question about those problems, including the code that you have written.