Yet another newbie question...with a twist ;->
Hm...it appears that the inclusion of commas turns my "numbers" into "strings"
Hm..I gotta get rid of these comma's
Well lets see...that means I've got to:
1. check all characters in the string
2. see if the "," (comma) character is in the string
3. if so, remove the comma character
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
// cloak from downlevel browsers
var price = document.frm_search.txt_sales_price.value
var loan = document.frm_search.txt_loan_amount.value
var ltv = loan/price;
var calc_ltv = Math.round((ltv - 0) * 100) + '%';
document.frm_search.txt_ltv.value = calc_ltv
// end cloak -->
Sales Price/Value (enter dollar amount)<br>
<input type="text" name="txt_sales_price" size="20">
Loan Amount (enter dollar amount)<br>
<input type="text" name="txt_loan_amount" size="20" onchange="getLoanAmount(this)">
Loan To Value (LTV)<br>
<input type="text" name="txt_ltv" size="20">
This issue has "illuminated" the need to learn how to manipulate string functions. My google search for a simple explanation of how to do this turned up (at best) the following (below) which ihave gleaned to be regular expressions (of which I know very little about).
var objRegExp = /,/g; //search for commas globally
//replace all matches with empty strings
So it appears im due for a crash course in string manipulation. Since I learn best when confronting a problem I seek an "understanding of the approach" to solving the issues presented in items (1,2 & 3) above. [Please read my newbie disclaimer before you answer (as it will affect the dispensation of points)]
Please note: I am a rookie, the "greenest" of greenhorns. When I submit a question what I am looking for is a clear understanding of WHAT I AM DOING WRONG (the theory). Many have supplied code samples with no explanation. I have found that this only helps SOMETIMES. If I don't understand the error - I (in my "green"-ness) - will most likely commit the same error over and over again UNTIL I UNDERSTAND why I keep committing the same error.
That being said... CODE ONLY ANSWERS WILL GET NO POINTS FROM ME! Not to be nasty, but again I'm trying to learn. So please, simply ADD A SENTENCE OR TWO EXPLAINING WHAT I'M DOING WRONG to help clear the fog.
I don't belive in giving ANYTHING less than 500 points because I consider EVERY question "extremely important". Important to either a project (yeah right) or my continued journey out of the land of the Newbie. On the other hand You Guys and Gals already know this stuff and make money doing it, yet you still find the time to answer questions to the benefit of us all. Thats definitely worth 500 point to me.
Thank you for your patience and understanding