Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2013
    Posts
    44
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    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.

  • #3
    New Coder
    Join Date
    Feb 2013
    Posts
    44
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,910
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    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.

  • #5
    New Coder
    Join Date
    Feb 2013
    Posts
    44
    Thanks
    2
    Thanked 0 Times in 0 Posts
    actually works fine without document

    I had the value being retrieved to wrong input element


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •