convert a string and number into a string
Posted: Fri Jul 11, 2003 10:28 am
hi all
i have a variable called theval i pass to a function. i then loop the variable and want to add the variable i to the end of the string and represent the entire thing into a string.
i have tried eval, concentate, tostring() but nothing works.
for example i do this
<input type=checkbox id="m3" onlcick="clickall('m3')" value=1 name="lid[]">
the function does this - the problem is on line:
if (allInputs.type == "checkbox" && allInputs.id.substring(0,10) == theval+i)
the variable theval is in a string but how do i make the variable 'i' part of the string in the if statement. i have tried to set it outside and all kinds of things but it doesent happen.
ANY HELP WOULD BE APPRECIATED. BEEN WORKING ON THIS ALL DAY....DOING MY HEAD IN RIGHT NOW.
function clickall(theval) {
var allInputs = document.getElementById("form1").getElementsByTagName("input")
for (var i = 1; i < allInputs.length; i++) {
if (allInputs.type == "checkbox" && allInputs.id.substring(0,10) == theval+i) {
alert("yes")
}
}
}
i have a variable called theval i pass to a function. i then loop the variable and want to add the variable i to the end of the string and represent the entire thing into a string.
i have tried eval, concentate, tostring() but nothing works.
for example i do this
<input type=checkbox id="m3" onlcick="clickall('m3')" value=1 name="lid[]">
the function does this - the problem is on line:
if (allInputs.type == "checkbox" && allInputs.id.substring(0,10) == theval+i)
the variable theval is in a string but how do i make the variable 'i' part of the string in the if statement. i have tried to set it outside and all kinds of things but it doesent happen.
ANY HELP WOULD BE APPRECIATED. BEEN WORKING ON THIS ALL DAY....DOING MY HEAD IN RIGHT NOW.
function clickall(theval) {
var allInputs = document.getElementById("form1").getElementsByTagName("input")
for (var i = 1; i < allInputs.length; i++) {
if (allInputs.type == "checkbox" && allInputs.id.substring(0,10) == theval+i) {
alert("yes")
}
}
}