am working with that code, when i click addrow button onclick function is not working in IE but working in mozilla, chrome
code is
<td><INPUT type="button" value="Add Row" onClick="addRow ('dataTable')" class="btnExamp le" style="width:70 px;"/></td>
<td><INPUT type="button" value="Delete Row" onClick="remove Row('dataTable' )" class="btnExamp le" style="width:85 px;"/></td>
</tr>
</table>
<table id="dataTable" style="margin-right:auto">
<tr>
<td>
<?php $result = mysql_query("se lect customer from customer"); echo "<select name = \"customervisit 1\" style=\"width:1 25px;\">\n"; while ($row = mysql_fetch_ass oc($result)) { echo '<option value = "'.$row[customer].'">'.$row[customer].'</option>';} echo "</select>"; ?>
</td>
<td><input type="checkbox" name="chk1[]" value="mon," style="width:65 px;"></td>
<td width="29"><inp ut type="checkbox" name="chk1[]" value="tue," style="width:65 px;"></td>
<td width="35"><inp ut type="checkbox" name="chk1[]" value="wed," style="width:65 px;"></td>
<td width="31"><inp ut type="checkbox" name="chk1[]" value="thu," style="width:65 px;"></td>
<td width="24"><inp ut type="checkbox" name="chk1[]" value="fri," style="width:65 px;"></td>
<td width="140"><in put class="input" type="text" name="pvdescrip tion1" value="<?php if(isset($_POST['pvdescription'])) { echo $_POST['pvdescription'];} ?>" style="width:12 5px;" ></td>
</tr>
</table>
javascript function is
function addRow(tableID) {
var rowid = parseInt(docume nt.getElementBy Id('customerro' ).value)+1;
var content='';
content +='<td>';
content +='<select name="customerv isit'+rowid+'" type="text" id="customervis it'+rowid+'" class="inputt" value = "" style="width:12 5px;">';
content +='<option value="" >-- select --</option>';
content +='<?php echo $customer; ?>';
content +='</select>';
content +='</td>';
content +='<td><input type="checkbox" name="chk'+rowi d+'[]" value="mon," style="width:65 px;"></td>';
content +='<td width="29"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="tue," style="width:65 px;"></td>';
content +='<td width="35"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="wed," style="width:65 px;"></td>';
content +='<td width="31"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="thu," style="width:65 px;"></td>';
content +='<td width="24"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="fri," style="width:65 px;"></td>';
content +='<td width="140"><in put type="text" class="input" name="pvdescrip tion'+rowid+'" value="" style="width:12 5px;" ></td>';
content +='';
document.getEle mentById('custo merro').value = rowid;
var table = document.getEle mentById(tableI D);
var rowCount = table.rows.leng th;
var row = table.insertRow (rowCount);
row.innerHTML = content;
}
function removeRow(table ID)
{
// grab the element again!
var tbl = document.getEle mentById(tableI D);
// grab the length!
var lastRow = tbl.rows.length ;
// delete the last row if there is more than one row!
if (lastRow > 1) tbl.deleteRow(l astRow - 1);
var rowid = parseInt(docume nt.getElementBy Id('customerro' ).value)-1
document.getEle mentById('custo merro').value = rowid;
}
</script>
code is
<td><INPUT type="button" value="Add Row" onClick="addRow ('dataTable')" class="btnExamp le" style="width:70 px;"/></td>
<td><INPUT type="button" value="Delete Row" onClick="remove Row('dataTable' )" class="btnExamp le" style="width:85 px;"/></td>
</tr>
</table>
<table id="dataTable" style="margin-right:auto">
<tr>
<td>
<?php $result = mysql_query("se lect customer from customer"); echo "<select name = \"customervisit 1\" style=\"width:1 25px;\">\n"; while ($row = mysql_fetch_ass oc($result)) { echo '<option value = "'.$row[customer].'">'.$row[customer].'</option>';} echo "</select>"; ?>
</td>
<td><input type="checkbox" name="chk1[]" value="mon," style="width:65 px;"></td>
<td width="29"><inp ut type="checkbox" name="chk1[]" value="tue," style="width:65 px;"></td>
<td width="35"><inp ut type="checkbox" name="chk1[]" value="wed," style="width:65 px;"></td>
<td width="31"><inp ut type="checkbox" name="chk1[]" value="thu," style="width:65 px;"></td>
<td width="24"><inp ut type="checkbox" name="chk1[]" value="fri," style="width:65 px;"></td>
<td width="140"><in put class="input" type="text" name="pvdescrip tion1" value="<?php if(isset($_POST['pvdescription'])) { echo $_POST['pvdescription'];} ?>" style="width:12 5px;" ></td>
</tr>
</table>
javascript function is
function addRow(tableID) {
var rowid = parseInt(docume nt.getElementBy Id('customerro' ).value)+1;
var content='';
content +='<td>';
content +='<select name="customerv isit'+rowid+'" type="text" id="customervis it'+rowid+'" class="inputt" value = "" style="width:12 5px;">';
content +='<option value="" >-- select --</option>';
content +='<?php echo $customer; ?>';
content +='</select>';
content +='</td>';
content +='<td><input type="checkbox" name="chk'+rowi d+'[]" value="mon," style="width:65 px;"></td>';
content +='<td width="29"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="tue," style="width:65 px;"></td>';
content +='<td width="35"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="wed," style="width:65 px;"></td>';
content +='<td width="31"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="thu," style="width:65 px;"></td>';
content +='<td width="24"><inp ut type="checkbox" name="chk'+rowi d+'[]" value="fri," style="width:65 px;"></td>';
content +='<td width="140"><in put type="text" class="input" name="pvdescrip tion'+rowid+'" value="" style="width:12 5px;" ></td>';
content +='';
document.getEle mentById('custo merro').value = rowid;
var table = document.getEle mentById(tableI D);
var rowCount = table.rows.leng th;
var row = table.insertRow (rowCount);
row.innerHTML = content;
}
function removeRow(table ID)
{
// grab the element again!
var tbl = document.getEle mentById(tableI D);
// grab the length!
var lastRow = tbl.rows.length ;
// delete the last row if there is more than one row!
if (lastRow > 1) tbl.deleteRow(l astRow - 1);
var rowid = parseInt(docume nt.getElementBy Id('customerro' ).value)-1
document.getEle mentById('custo merro').value = rowid;
}
</script>
Comment