thanks for the responses, below is the code, it is aspx pages. I created a
small sample web app with only 3 webpages and it works fine but when
integrating it into a large web app I ran into the following problems. When
I call the javascript function (calcBalancenew) and try to pass in the
textbox values there is a java error txbx1 not defined. Note the first
attribute works since I am just passing in integers but the others fail. The
second problem is that in the java script function (calcBalancenew) where I
try to write the results to textbox 4 with
document.forms[0].txbx4.value = total;
I get the error document.forms.0.txbx4 is null or not an object,
so it looks like it can not find it, so thinking I am not accessing the form
correctly.
The large web app uses a master page and all other pages are content of the
master page when it gets loaded in.
I have a simple java function that just adds values in text boxes 1 through
4 and displays the results in text box 4.
In the code behind to use the onblur event with asp.net textbox controls for
4 textboxes I have
txbx1.Attributes["onblur"] = "calcBalancenew(7,1,2,3)";
txbx2.Attributes["onblur"] =
"calcBalancenew(txbx1.value,txtbx2.value,txbx3.value,txbx4.value)";
txbx3.Attributes["onblur"] =
"calcBalancenew(txbx1.value,txbx2.value,txbx3.value,txbx4.value)";
txbx4.Attributes["onblur"] =
"calcBalancenew(txbx1.value,txbx2.value,txbx3.value,txbx4.value)";
--
Paul G
Software engineer.
Nathan Sokalski said:
Is this an page created by ASP.NET (*.aspx)? If it is, it should only have
one form. Also, if the textbox was created by an ASP.NET TextBox server
control (I'm assuming it was since this is an ASP.NET newsgroup), then not
only will the id attribute in the generated HTML be different than the one
in your *.aspx source file, but I would recommend using
document.getElementById(...).value instead (this is what is normally used,
and it does not require an index). My suggestions are based on the
assumption this is an ASP.NET *.aspx Page, if this assumption is incorrect
we may need to see your source code to determine your problem. Good Luck!
--
Nathan Sokalski
(e-mail address removed)
http://www.nathansokalski.com/
Mark Rae said:
I have a javascript that I am setting a value of a textbox in and have the
following
document.forms[0].textbox1.value = total;
I get a run time error null value but I think the problem is the form
index
0. The web application has about 20 forms, is there anyway to tell what
the
index should be?
Can't you refer to the form by its name...?
http://www.devguru.com/Technologies/ecmascript/quickref/doc_forms.html