J
Jon
Hi all,
I'm doing a small project for work and I have this problem, I have a
text area, named with a unique identifier (the name, although I have
tried to put in an ID as well). I have a number in this text field,
and I want to have a button to the right of it that increments this
number by one. The problem is that so far I am unable to figure out
how to find th element using javascript. I pass the identifier into a
javascript function I wrote:
function increment(ident)
{
var level = document.getElementById(ident);
level_val = parseInt(level.value,10);
level_val++;
level.value = level_val;
}
The HTML that holds the input area is here...
<td align=center><input type=text value="Not Priced" name=25881 size=7
maxlength=10 ></td>
<td><INPUT type="button" name="increment25881" value="+1"
onClick=increment("25881")></td>
And it's not incrementing. The form is called tableprices. Another
thing I did, that I thought should work, is type in a value, 87, into
the text input field and then tried incrementing, but it still didn't
work. Any ideas? Thanks!
Jon
I'm doing a small project for work and I have this problem, I have a
text area, named with a unique identifier (the name, although I have
tried to put in an ID as well). I have a number in this text field,
and I want to have a button to the right of it that increments this
number by one. The problem is that so far I am unable to figure out
how to find th element using javascript. I pass the identifier into a
javascript function I wrote:
function increment(ident)
{
var level = document.getElementById(ident);
level_val = parseInt(level.value,10);
level_val++;
level.value = level_val;
}
The HTML that holds the input area is here...
<td align=center><input type=text value="Not Priced" name=25881 size=7
maxlength=10 ></td>
<td><INPUT type="button" name="increment25881" value="+1"
onClick=increment("25881")></td>
And it's not incrementing. The form is called tableprices. Another
thing I did, that I thought should work, is type in a value, 87, into
the text input field and then tried incrementing, but it still didn't
work. Any ideas? Thanks!
Jon