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 03-02-2011, 11:08 AM   PM User | #1
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
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
Narasimha Rao K is offline   Reply With Quote
Old 03-02-2011, 11:14 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Please show the HTML code for the element including the onchange call
devnull69 is offline   Reply With Quote
Old 03-02-2011, 11:18 AM   PM User | #3
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
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);
}
Narasimha Rao K is offline   Reply With Quote
Old 03-02-2011, 11:44 AM   PM User | #4
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Quote:
This Is the HTML code
No, that's your Javascript.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-02-2011, 11:48 AM   PM User | #5
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
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.
bullant is offline   Reply With Quote
Old 03-02-2011, 11:52 AM   PM User | #6
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
the code of the control is:

<asp:TextBox ID="txt_Date" TabIndex="2" runat="server" MaxLength="25" onchange="ClearingLR(this);" />
Narasimha Rao K is offline   Reply With Quote
Old 03-02-2011, 12:00 PM   PM User | #7
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Quote:
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?
bullant is offline   Reply With Quote
Old 03-02-2011, 12:02 PM   PM User | #8
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
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.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 03-02-2011, 12:05 PM   PM User | #9
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
thanks,
I change the "ID".
Narasimha Rao K is offline   Reply With Quote
Old 03-02-2011, 12:06 PM   PM User | #10
Narasimha Rao K
New Coder

 
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Narasimha Rao K is an unknown quantity at this point
Thanks to respond
i got the solution.
Narasimha Rao K is offline   Reply With Quote
Old 03-02-2011, 12:17 PM   PM User | #11
bullant
Banned

 
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
bullant is on a distinguished road
Quote:
Originally Posted by Narasimha Rao K View Post
thanks,
I change the "ID".
no problem
bullant 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 06:04 PM.


Advertisement
Log in to turn off these ads.