Jump to content


Photo

Change the stringe to Number ? [ how ]


  • Please log in to reply
3 replies to this topic

#1 Dooq

Dooq
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 11 April 2006 - 11:10 AM

Hi

How can i change a string to number ?

when i get the data using innerHTML method the data will be string,but i need to change the data type to do some Math work on it.

Regards

#2 Develop_Sake

Develop_Sake
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 17 April 2006 - 11:37 PM

There are several way to convert stringe to numeric.
one of them is parseInt(); Function.
parseInt('22')

regards,

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 17 April 2006 - 11:47 PM

php variables are 'loosely typed'. If you add zero to a string you get a number.
Legend has it that reading the manual never killed anyone.
My site

#4 Develop_Sake

Develop_Sake
  • New Members
  • Pip
  • Newbie
  • 7 posts

Posted 18 April 2006 - 01:50 PM

Maybe i didn't get what he need.
we are in Javascript Help and he say [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]when i get the data using innerHTML[/quote] innerHTML toled me that he taking about JavaScript not php.

regards




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users