Transform your input text control into a spin edit control (aka up-down | numeric edit control). -->
input tag,
or using a special id attribute.
At the head section of your page, add two following lines:
<script type="text/javascript" src="spineditcontrol.js"></script>
<link type="text/css" rel="stylesheet" href="spineditcontrol.css">
Now, you have two options, according if is important for you complaint with XHTML:
You need to add some attributes to your input text tag code, as following example:
<input type="text" name="edit1" id="edit1"
spinedit="true" spinedit_min="minval" spinedit_max="maxval" spinedit_step="stepval">
Where minval, maxval and stepval are
numbers to indicate the range and and step values. For example:
<input type="text" name="edit1" id="edit1"
spinedit="true" spinedit_min="0" spinedit_max="100" spinedit_step="2">
In previous example, the SpinEditControl range is [0..100] with increment value of 2. If you don't specify step value, default is 1.
You need to use an id attribute with following characteristics:
A prefix CEC_ + any name + minval + _ + maxval +
_ + stepval. For example, if you want to idicate a range from 0 to 100,
with a step value of 2, you need an id attribute as following:
<input type "text" name="edit1" id="SEC_edit1_0_100_2">
Again, if you don't specify step value, 1 is assumed.
Now, you cannot write other symbols than numbers. If you write a number out of range, the min or max value is assigned. Use up and down arrow keys or spin buttons to increase/decrease the value.
spineditcontrol.css.
Version history:
Here's a tgz file with complete code and examples.
By Hugo Ortega-Hernández - hugorteg{drop-this-text}@gmail.com
You can support free software! Consider that there are non-free similar projects, with less features and higher costs... so, if you donate some money, you can contribute to develop more quality free software: