Formular: Inputfield with UP/Down-Control element

B

Bobel

Hi,

I am searching for an Input box, where I am able as one possibility to
enter a number, and as an second possible action, click one of two
small buttons on the side to increase/decrease the number in the box.

a second small question, is it possible, to declare all the values, of
input boxes at the beginning of my HTML-document? (I mean values, that
are entered, at loading of the page)

thanxs

Martin Stanka
 
L

Lasse Reichstein Nielsen

I am searching for an Input box, where I am able as one possibility to
enter a number, and as an second possible action, click one of two
small buttons on the side to increase/decrease the number in the box.

<form ...>
<input type="text" name="number">
<input type="button" value="+"
onclick="this.form.elements['number'].value++">
<input type="button" value="-"
onclick="this.form.elements['number'].value--">
a second small question, is it possible, to declare all the values, of
input boxes at the beginning of my HTML-document? (I mean values, that
are entered, at loading of the page)

The initial values of the input elements can be written as part of the
input tag: <input type="text" value"my initial value">
It is by far the safets way to do it.

You can use Javascript to enter the values later, but you have to wait
for the form controls to be loaded, and then the user might start filling
in the first ones before the later ones have loaded, and setting the
value later will overwrite the user's entry. It's dangerous, and I would
recommend against it.

/L
 
T

Thomas 'PointedEars' Lahn

Lasse said:
The initial values of the input elements can be written as part of the
input tag: <input type="text" value"my initial value">

<input value="my initial value">

For the typo and for `text' is the default value.


PointedEars
 
B

Bobel

Hi,

Lasse Reichstein Nielsen said:
The initial values of the input elements can be written as part of the
input tag: <input type="text" value"my initial value">
It is by far the safets way to do it.

yes, i knew this, but I am processing my HTML-page, before sending to
the client, through a C-Programm, and, one thing i do, is replace a
tag, with the value of my text-box with the real number, if i could do
this, at the beginning of the programm trough javascript, i am able to
save time. (before you recomment it, the webserver is a small uC, so i
have no access to PHP or standart CGI-functions)
You can use Javascript to enter the values later, but you have to wait
for the form controls to be loaded, and then the user might start filling
in the first ones before the later ones have loaded, and setting the

that shouldn`t be the problem, because at the moment, i only serve my
pages in a local net.

Thanx for your help

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top