views:

629

answers:

2

i wanna draw a login interface,so i have to draw the textfield to input and button to submit! if i achieve it by using input and button tag,it will be easy!but i was required to draw them in the canvas using html5.0 . i have searched google for two days,i cannot find a good idea! who has experience? help me! thanks in advance!

A: 

You want to draw a login interface onto a ? I don't quite know what you wouldn't use regular graphics, but here's a tutorial on the basics of how the canvas tags works and what you can do with it.

Tom
+7  A: 

I would very much recommend using the HTML elements for this. You can overlay them over the canvas using CSS positioning, so it will seem like they are part of whatever you have drawn on the canvas itself.

Creating this purely with canvas is very challenging.

Firstly, you will need to create routines to draw input boxes and the button. Then, you'll need routines to draw them in different states, like button when it's pressed down. You'll also need to write code that takes care of displaying the caret in the textboxes, the characters the user types, add code to handle key events to produce keys, handle copypaste key combinations, handle arrow keys and clicking on different parts of the text to move around...

And much more.

Seriously. Do it with the HTML input elements. Based on your question that's the best choice.

Jani Hartikainen