Hi Ruth,
Let's get this straight: your JavaScript function works correctly?
If that's the case, then you're not actually having trouble with innerHTML,
right? If this is correct, then the subject of message is incorrect, and your
real problem is with processing an arbitrary number of form elements having
dynamically generated names, right?
Since you didn't say what you're using on the server to process your form, it's
not possible to offer a definitive answer/solution; however, I can tell you that
in most server-side languages/environments, you can simply loop through the
array of POST values.
For example, PHP has the $_POST array, and you can get at all form fields and
their values by looping through it like this:
foreach($_POST as $field => $value)
{
// ...
}
So if you want to do something with data from a bunch of form fields whose names
are "row1", "row2", "row3", etc., one way you can do that is like so:
foreach($_POST as $field => $value)
{
// does the name of the field contain 'row'...?
if(strpos($field, 'row') !== FALSE)
{
do_something_with($value);
// ...
}
}
I'm not going to spend any more time on this here since this is a JS list and
yours is a server-side issue, but maybe this helped get you started. If you need
more help, please ask for it on a list or forum that's specific to the
server-side language and database that you're using.
cheers
jon.
> Posted by: "Ruth Marya" ruth.marya%40gmail.com">ruth.marya
gmail.com rya_acem_manice
> Date: Fri Mar 14, 2008 10:02 am ((PDT))
>
> Guys,
>
> I need your help,please...
> I have problem with javascript inner.html...
> here is the code:
>
> function ExpandTable()
> {
> s="<table border=0><tr>";
> //s+="<td bgcolor='#ffeeee' colspan="+(splitnum)+"><td colspan="
> //s+=splitnum+"></td></tr>";
> for (i=0;i<splitnum;i++){
> n++;
> ya++;
> cn++;
> pl++;
> sl++;
> jd++;
> //s+="<tr><td width='254' class='tdHeadA'>Company Name"+n
> s+="<tr><td width='191' class='tdHeadA'>Year:</td><td width='191'>"
> s+="<input type='text' name='yearAttend"+ya+"' />"
>
> s+="<tr><td width='191' class='tdHeadA'>Company Name:</td><td
> width='191'>"
> //s+=":</td><td width='279'>"
> s+="<input type='text' name='compName"+cn+"' />"
> //s+="<input type='text' name='compName' />"
> //s+="</td></tr><tr><td class='tdHeadA'>Position Level"+n
> s+="</td></tr><tr><td class='tdHeadA'>Position Level:</td><td>"
> //s+=":</td><td>"
> //s+="<input type='text' name='positionLvl' />"
> s+="<input type='text' name='positionLvl"+pl+"' />"
>
> s+="</td></tr><tr><td class='tdHeadA'>Salary:</td><td>"
> s+="<input type='text' name='salary"43;sl+"' />"
>
> s+="</td></tr><tr><td class='tdHeadA'>Description of Job:</td><td>"
> s+="<textarea name='jobdesc"+jd+"' cols='60' rows='5'></textarea>"
>
> s+="</td></tr>";
> }
> alert("jobdesc"+jd);
> s+="</tr></table>";
> document.getElement