Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2013, 07:18 AM   PM User | #1
billboy
New Coder

 
Join Date: Feb 2013
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
billboy is an unknown quantity at this point
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
billboy is offline   Reply With Quote
Old 02-18-2013, 07:21 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 02-18-2013, 08:06 AM   PM User | #3
billboy
New Coder

 
Join Date: Feb 2013
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
billboy is an unknown quantity at this point
Quote:
Originally Posted by Philip M View Post
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.
billboy is offline   Reply With Quote
Old 02-18-2013, 08:31 AM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,043
Thanks: 197
Thanked 2,412 Times in 2,390 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by billboy View Post
I did it doesnt work.
Should be document.myform
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is offline   Reply With Quote
Old 02-18-2013, 08:57 AM   PM User | #5
billboy
New Coder

 
Join Date: Feb 2013
Posts: 37
Thanks: 1
Thanked 0 Times in 0 Posts
billboy is an unknown quantity at this point
actually works fine without document

I had the value being retrieved to wrong input element
billboy is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:21 AM.


Advertisement
Log in to turn off these ads.