By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

Formular: Inputfield with UP/Down-Control element

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.