CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   onblur use function to change value of element (http://www.codingforums.com/showthread.php?t=287817)

billboy 02-18-2013 07:18 AM

onblur use function to change value of element
 
Is it possible to do something like this?

Code:

onblur="this.value=myPaymentCalc(myform.credC2rate.value,myform.credC2Pmt.value,myform.credC2.value);"/>

I want to change the value of the element based on the return value of the function


The function

myPaymentCalc( uses 3 arguments)

returns pmts



I would like the text value of input element to change to pmts

Philip M 02-18-2013 07:21 AM

Yes, but that sort of inline code is generally thought to be difficult to understand and maintain.

But why do you not just try it?

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

billboy 02-18-2013 08:06 AM

Quote:

Originally Posted by Philip M (Post 1314062)
Yes, but that sort of inline code is generally thought to be difficult to understand and maintain.

But why do you not just try it?

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

I did it doesnt work.

Philip M 02-18-2013 08:31 AM

Quote:

Originally Posted by billboy (Post 1314068)
I did it doesnt work.

Should be document.myform

billboy 02-18-2013 08:57 AM

actually works fine without document

I had the value being retrieved to wrong input element


All times are GMT +1. The time now is 11:45 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.