Hi,
I have a for loop that is to look through all fields entered into a form and remove the leading zeros. It works, but only loops through once. Is there some kind of thing that once I return the leadingZero function as true the loop break or something? Any help is appreciated! thanks! This function looks like this:
function zeroStrip(input){
for(i = 0, leadingZeros = 0; i < input.length; i++)
if(input.charAt(i) == “0”)leadingZeros++;
// once something other than 0 is found…stop the loop
// remove leading zeros
input = input.substr(leadingZeros);
return input
}//end of zeroStrip function
And I call it like this:
for(i=0; i<document.FrontPage_Form2.elements.length; i++){
input = document.FrontPage_Form2.elements[i].value + “”
if(input.charAt(0) == “0”){
document.FrontPage_Form2.elements[i].value = zeroStrip(input)
input = “”
}//end of if
}//end of for