By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,568 Members | 1,194 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,568 IT Pros & Developers. It's quick & easy.

innerHTML Method

P: 13
Hi All,

Can anybody tell me why the below doesn't work;

Expand|Select|Wrap|Line Numbers
  1. T_Price = 23;
  2.  
  3. document.GetElementByID("store_price").innerHTML = T_Price.toFixed(2);
  4.  
If i try

Expand|Select|Wrap|Line Numbers
  1. document.GetElementByID("store_price").innerHTML = 'Mama Mia!';
  2.  
It works fine, all help appreciated!
Aug 9 '08 #1
Share this Question
Share on Google+
4 Replies


P: 13
Got this error fixed, anybody has this problem.. i forgot that javascript it case sensitive it should have been;

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("store_price").innerHTML = T_Price.toFixed(2);
  2.  
Aug 9 '08 #2

acoder
Expert Mod 15k+
P: 16,027
That's correct, of course, but I'm intrigued as to how the second line worked.
Aug 9 '08 #3

P: 13
Hi,

Because when i copied and pasted the second line of the internet and into my code (from a innerHTML sample).

But when i wrote it above i made the same mistake again of the case sensitive thingy..

So the one above didn't work.. but the one i got of the internet did..
Aug 9 '08 #4

acoder
Expert Mod 15k+
P: 16,027
That explains it. I did think as much, but just making sure. Thanks.

If you're new to JavaScript, the case-sensitivity problem is a common one, especially if you're used to using a language which is not so strict.
Aug 9 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.