Enjoy an ad free experience by logging in. Not a member yet?
Register .
03-02-2011, 11:08 AM
PM User |
#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
03-02-2011, 11:14 AM
PM User |
#2
Senior Coder
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
Please show the HTML code for the element including the onchange call
03-02-2011, 11:18 AM
PM User |
#3
New Coder
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
devnull69
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);
}
03-02-2011, 11:44 AM
PM User |
#4
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
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)
03-02-2011, 11:48 AM
PM User |
#5
Banned
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
Quote:
Originally Posted by
Narasimha Rao K
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.
03-02-2011, 11:52 AM
PM User |
#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);" />
03-02-2011, 12:00 PM
PM User |
#7
Banned
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
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
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?
03-02-2011, 12:02 PM
PM User |
#8
Supreme Master coder!
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
Quote:
Originally Posted by
Narasimha Rao K
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)
03-02-2011, 12:05 PM
PM User |
#9
New Coder
Join Date: Feb 2011
Location: India
Posts: 20
Thanks: 1
Thanked 0 Times in 0 Posts
thanks,
I change the "ID".
03-02-2011, 12:06 PM
PM User |
#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.
03-02-2011, 12:17 PM
PM User |
#11
Banned
Join Date: Feb 2011
Posts: 2,699
Thanks: 13
Thanked 395 Times in 395 Posts
Quote:
Originally Posted by
Narasimha Rao K
thanks,
I change the "ID".
no problem
Jump To Top of Thread
Thread Tools
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
HTML code is Off
All times are GMT +1. The time now is 06:04 PM .
Advertisement
Log in to turn off these ads.