470,594 Members | 1,444 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,594 developers. It's quick & easy.

Formular: Inputfield with UP/Down-Control element

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
Jul 20 '05 #1
3 3564
Ma***********@leuze.de (Bobel) writes:
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--">
</form>
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Lasse Reichstein Nielsen wrote:
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
Jul 20 '05 #3
Hi,

Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<he**********@hotpop.com>...
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.


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
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Clemens Richter | last post: by
1 post views Thread by Dan | last post: by
1 post views Thread by Niko Mann | last post: by
reply views Thread by Brunner | last post: by
1 post views Thread by pmelanso | last post: by
7 posts views Thread by callawayglfr | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.