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 11 of 11
  1. #1
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Java Script Error

    Hello Everybody,

    Plese find the solution for this error,

    i have a textbox(id=txt_Acronym), when i fill the data into that control

    i get this error(document.getElementById()is null or not an object),Iam calling The Java script Function in "onchange".


    Yours
    NARASIMHA RAO K

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,355
    Thanks
    11
    Thanked 558 Times in 551 Posts
    Please show the HTML code for the element including the onchange call

  • #3
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by devnull69 View Post
    Please show the HTML code for the element including the onchange call
    This Is the HTML code

    function ClearingLR(){
    document.getElementById("txt_Acronym").value=Trim(document.getElementById("txt_Acronym").value);
    document.getElementById("txt_Rolename").value=Trim(document.getElementById("txt_Rolename").value);
    }

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    This Is the HTML code
    No, that's your Javascript.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Narasimha Rao K View Post
    i get this error(document.getElementById()is null or not an object),Iam calling The Java script Function in "onchange".
    That error message is telling you exactly what the problem is. Either an element with that id does not exist in your html or it does exist but you are calling the function before the element has been loaded.

  • #6
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts
    the code of the control is:

    <asp:TextBox ID="txt_Date" TabIndex="2" runat="server" MaxLength="25" onchange="ClearingLR(this);" />

  • #7
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    That error message is telling you exactly what the problem is. Either an element with that id does not exist in your html or it does exist but you are calling the function before the element has been loaded.
    Quote Originally Posted by Narasimha Rao K View Post
    the code of the control is:

    <asp:TextBox ID="txt_Date" TabIndex="2" runat="server" MaxLength="25" onchange="ClearingLR(this);" />
    so where are the elements you refer to in your js function?

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Quote Originally Posted by Narasimha Rao K View Post
    the code of the control is:

    <asp:TextBox ID="txt_Date" TabIndex="2" runat="server" MaxLength="25" onchange="ClearingLR(this);" />
    Get the complete HTML source of your page from your browser's "view source" option and post it here.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #9
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts
    thanks,
    I change the "ID".

  • #10
    New Coder
    Join Date
    Feb 2011
    Location
    India
    Posts
    20
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks to respond
    i got the solution.

  • #11
    Banned
    Join Date
    Feb 2011
    Posts
    2,699
    Thanks
    13
    Thanked 395 Times in 395 Posts
    Quote Originally Posted by Narasimha Rao K View Post
    thanks,
    I change the "ID".
    no problem


  •  

    Posting Permissions

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