why this does not work

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!
 
N

Nick Gilbert

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top