Hello,
I have same basic (beginner's) problem with JS.
sample from the JS ....
------------------------------------------------------------
function recalc(form)
{
for ... {
var quantity;
XXX: quantity=eval("form.quantity"+i+".value"
;
parent.izd.kol = quantity;
.... end for }
}
--------------
htmout = '<div align="center"><input type="text" name="quantity' + i +
'" size="3" maxlength="3" value="' + parent.izd.kol +
'"> <input type="button" value="Recalc" onClick="recalc(this.form)">'
.
.
.
.
for i .... {
document.write(htmout);
end for ... }
--------------> This portion of JS works fine, I got all the right values displayed. All the variables are assigned at the beginning (array) !
but I have a problem with recalc(): how can I access the value of 'quantity'+i when is changed.
recalc() always ends up with an error: object required, error in line XXX.
Can I access and assign a value of (input type=text....) with onChange event to 'parent.izd.kol' ???
Both parts of JS resides in the same HTML file.
To shorten: I have a problem accessing (and assigning) values to/from input form (type=text,name=smthng+variable) if I want to use a loop and variables to have different set of names for input form !
I know that I'm probably doing something wrong but I'm all out of clues !!
If you're willing to help and need more info, just let me know !
Thanks for help and suggestions !
I have same basic (beginner's) problem with JS.
sample from the JS ....
------------------------------------------------------------
function recalc(form)
{
for ... {
var quantity;
XXX: quantity=eval("form.quantity"+i+".value"
parent.izd.kol = quantity;
.... end for }
}
--------------
htmout = '<div align="center"><input type="text" name="quantity' + i +
'" size="3" maxlength="3" value="' + parent.izd.kol +
'"> <input type="button" value="Recalc" onClick="recalc(this.form)">'
.
.
.
.
for i .... {
document.write(htmout);
end for ... }
--------------> This portion of JS works fine, I got all the right values displayed. All the variables are assigned at the beginning (array) !
but I have a problem with recalc(): how can I access the value of 'quantity'+i when is changed.
recalc() always ends up with an error: object required, error in line XXX.
Can I access and assign a value of (input type=text....) with onChange event to 'parent.izd.kol' ???
Both parts of JS resides in the same HTML file.
To shorten: I have a problem accessing (and assigning) values to/from input form (type=text,name=smthng+variable) if I want to use a loop and variables to have different set of names for input form !
I know that I'm probably doing something wrong but I'm all out of clues !!
If you're willing to help and need more info, just let me know !
Thanks for help and suggestions !