paul2463 Posted April 24, 2007 Share Posted April 24, 2007 hello people, I have this function, well lots of functions really, but this one is becoming a headache for(i=0; i < 7; i++) { if(isdefined(document.datagrid.text+i)==true) { var text2 = document.datagrid.text+i.value; if (text2 != '') { textArr.push (queryArray[i]) ; textArr.push (text2); } } } the function isdefined() is working perfectly and has no bearing on the problem. the table that this works with is drawn dynamically with text boxes above each column for filtering purposes(to a maximum of 6 columns). when the filter button is pressed what I want to happen is textArr gets put into it the column name and then the word that has been placed in the text box. I think my changing the text box names dynamically with this function is my problem the text boxes are called text0 , text1 , text2 and so on until text6 if it goes that far so my function first checks to see if that text box has been drawn - if(isdefined(document.datagrid.text+i)==true) then I want to assign whatever is in that text box to the variable text2 but i think it does not like the document.datagrid.text+i.value because returns NAN every time. is it possible to dynamically create the text box names 0 - 6 if and when they are needed not the string assigned to them, the variables themselves?? to replace text+i which doesnt seem to work Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 24, 2007 Share Posted April 24, 2007 Not quite sure about your question. But this might be what you are seeking. The eval() function. Try search from the web about the usage. Hope this will help you. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 24, 2007 Share Posted April 24, 2007 Try document.datagrid[text+i].value; Quote Link to comment Share on other sites More sharing options...
paul2463 Posted April 25, 2007 Author Share Posted April 25, 2007 thanks guys after much hard work the eval() worked for me Topic Solved Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.