why this does not work

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

just wondering if anyone has an idea on why line 3 and 5does not work-does
not pass any numbers into the javascript function called javafunction1.
using asp.net textbox web control
txtbox1.Attributes.Add ("onblur","javafunction1(2,3,1)");//works
txtbox1.Attributes.Add
("onblur","javafunction1('txtbox2.value','txbox3.value',txtbox4.value)");
//seems to not pass in any numbers
txtbox1.Attributes.Add
("onblur","javafunction1(txtbox2.value,'xbox3.value,txtbox4.value)");
//error txbox2 not defined!
 
Paul said:
just wondering if anyone has an idea on why line 3 and 5does not work-does
not pass any numbers into the javascript function called javafunction1.
using asp.net textbox web control
txtbox1.Attributes.Add ("onblur","javafunction1(2,3,1)");//works
txtbox1.Attributes.Add
("onblur","javafunction1('txtbox2.value','txbox3.value',txtbox4.value)");
//seems to not pass in any numbers
txtbox1.Attributes.Add
("onblur","javafunction1(txtbox2.value,'xbox3.value,txtbox4.value)");
//error txbox2 not defined!

Because you're not actually accessing the client side text box properly.
You need to find the element first:

eg

javafunction1(getElementById('txtbox2').value, etc);

'txtbox2' needs to be the ID of the textbox control AS RENDERED CLIENT
SIDE (eg view the source) - not the server side name. It *might* happen
to be the same, but it might not - you'll need to check.

Nick...
 
Back
Top