Log in

View Full Version : What do you call this



manleybruce
11-10-2011, 02:40 AM
I have a screenshot on this attach document but I do not know what you call this type of function in a html form. Is it just simply a textarea with a scrollbar which allows you to select numbers higher or lower? If I know what it is then I can research this I find out how to code it myself.

Thank You

djr33
11-10-2011, 03:01 AM
If you could link us to the page we could tell you more about the code that generates it.

That's not a standard HTML object of any kind. It's probably just a textbox with up and down buttons (images?) next to it that have Javascript events attached: add or subtract one from the value in the box when you click on them. It wouldn't be very hard to duplicate.

I don't know of any scripts like that for a clock, but there must be some available for a date. You could try searching for something like "date input form" and see if you can find a tutorial or example script, then borrow some ideas from that.

traq
11-10-2011, 04:46 AM
html5 includes the <input type="number"> - Opera and Chrome use an interface similar to the pic you posted (sometimes called a "spinner" but I think that's a somewhat inadequate name). The particular control you posted is probably a javascript thing, though.

djr33
11-10-2011, 06:34 AM
Ah, I wasn't aware of that. Interesting. Even if that does work in some cases, for current purposes you'd need a backup using Javascript, since it won't be supported in all browsers yet.

Apparently there are lots of controls for it too:
http://dev.w3.org/html5/markup/input.number.html

That's fun.

traq
11-10-2011, 09:15 PM
yeah, even though some browsers (mostly mobile browsers) recognize it, they're still mostly limited to things like specialized controls. I don't believe any browser currently supports validation, for example.