I tested this as a stand alone and it worked fine... in all the browsers you mentioned...
<html>
<head>
<script type="text/javascript">
function addToRoster()
{
//find out how many people are already on the roster
var table = document.getElementById('roster');
var rows = roster.getElementsByTagName('tr');
var count = rows.length - 2; //two rows are automatically included: headers and button to add players
if(count == 4)
{
alert('You have already added the maximum number of players to your roster.');
return;
}
var lastRow = table.rows.length;
var row = table.insertRow(lastRow);
//name cell
var nameCell = row.insertCell(0);
var element = document.createElement('input');
element.type = 'text';
element.name = 'name';
element.size = 30;
nameCell.appendChild(element);
//rin cell
var rinCell = row.insertCell(1);
element = document.createElement('input');
element.type = 'text';
element.name = 'rin';
element.size = 12;
rinCell.appendChild(element);
//email cell
var emailCell = row.insertCell(2);
element = document.createElement('input');
element.type = 'text';
element.name = 'email';
element.size = 12;
emailCell.appendChild(element);
}
</script>
</head>
<body>
<table id="roster" border="1">
<tr>
<td>
This is the header 1
</td>
<td>
This is the header 2
</td>
<td>
This is the header 3
</td>
</tr>
<tr>
<td colspan="3">
<input type="button" value="Add Player" onclick="addToRoster()" />
</td>
</tr>
</table>
</body>
</html>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66:





by: zanus123Posted on 2009-10-11 at 21:01:19ID: 25548579
what does your full HTML look like
and does the error give a line number