views:

189

answers:

2

On this page, I have a form to enter information about students on a given roster. Each student is listed in a table with a drop down box and a comments field. There is an "add another" button for each student, so that if the user wants to enter a second note about a student, they can.

Clicking the button launches this javascript function:

var counter=1;
function multipleDemerits(studentID) {
counter++;
var anotherDemeritRow = "<select name='behavior_"+studentID+"_"+counter+"'><option value=0>Select  --></option><option value=0></option><option value=0>1 demerit behaviors</option><option value=1>&nbsp;&nbsp;unprepared</option><option value=2>&nbsp;&nbsp;incomplete hw</option><option value=3>&nbsp;&nbsp;electronics/phone</option><option value=4>&nbsp;&nbsp;uniform</option><option value=5>&nbsp;&nbsp;talking/making noise</option><option value=0></option><option value=0>2 demerit behaviors</option><option value=6>&nbsp;&nbsp;tardy</option><option value=7>&nbsp;&nbsp;wasting time</option><option value=8>&nbsp;&nbsp;food/gum</option></select>&nbsp;&nbsp;Comments: <input name='comments_"+studentID+"_"+counter+"' type='text' size='30' maxlength='100'/><br />&nbsp;";
document.getElementById(studentID).innerHTML += anotherDemeritRow;
}

The new drop down and comments field display perfectly in Mac browsers, but not so in Windows Firefox or IE. The height of the current table row does not increase, so the additional fields start to overlap the rest of the rows in the table. NOT what I want at all.

Any ideas from Windows browsers experts out there? Thanks!

Update: Changed to jQuery's append ... no difference. However, if I add an alert statement to the very beginning of the function, NOW it works. Huh?!?!

+1  A: 

I think you should use 'append()' instead of 'innerHTML', as it solves some table rendering problems in firefox and IE.

Aziz
this. innerHTML doesn't always play nicely with tables. Best to avoid it in the general sense. You might be able to create a standalone container(e.g., div), use innerHTML to create the structure, then append the div to the table/row.
Glenn
A: 

Could you try to make the table rows display block? That might fix the height.

Does windows firefox report any issues with the page?

Christian