Results 1 to 3 of 3

Thread: Textfield onchange function...

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    Textfield onchange function...

    In my html page, i am using the following code.

    input type="text" name="result" id="res" value="PASS" onchange="change_result();"

    The above function is working when the user change the text on the textfield. But if i change the value of the textfield dynamically(using javascript function)it is not working.

    Can anyone tell me why is not working? which function i am using here?

    --------------------
    suresh


  2. #2
    Junior Member
    Join Date
    Dec 2006
    Answers
    9

    Re: Textfield onchange function...

    S...even i also face the same problem...
    I just give one example , check it out whether it works......
    Example:
    function fun1()
    {
    if(document.f.na.value=="hello")
    {
    }
    else
    {
    alert("Text Changed")
    }
    }
    function fun2()
    {
    var mylist=document.getElementById("lang")
    document.getElementById("na").value=mylist.options[mylist.selectedIndex].text
    }

    form name=f>
    Language : select id=lang onchange=fun2(),fun1()>
    option selected>Java
    option>J2ME
    option>C#
    option>Dot Net
    /select>

    Favorite Language is :input type=Text name=na value="hello" onchange=fun1()>


    /form>

    Last edited by daisy_deepa; 06-02-2007 at 08:23 AM.

  3. #3
    Junior Member
    Join Date
    Feb 2009
    Answers
    9

    Re: Textfield onchange function...

    A client side code cannot call another client side function which is connected to a control as if the user types or moves the focus from the textfield the client side function would be called as the event takes place with the help of the user. but if the value of the textfield is changed thru a javascript function then the event onChange() wont fire as it looks for the user input change which doesnt happen in case of value change thru javascript..

    For more details visit: mithunondotnet.wordpress.com


  4.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact