我在一列中有一个带有编辑按钮的HTML表格。当用户按下“编辑”按钮时,其中一列应该可以编辑。这适用于Chrome / Safari / Firefox,但在IE中无效。它允许我按下编辑按钮,但是一旦按下它,它将不允许进行任何列编辑。
如何在IE中创建此功能? for file in files:
print "opening file ", file
f = open(file)
csv_n = csv.reader(f)
count = 0
thisList = list(csv_n)
与IE兼容吗?如果没有,那将是一种解决方法?
HTML:
contenteditable
JavaScript的:
<table id="merchTable" cellspacing="5" class="sortable">
<thead>
<tr class="ui-widget-header">
<th class="sorttable_nosort" style="display: none">ID</th>
<th class="sorttable_nosort">Loc</th>
<th class="merchRow">Report Code</th>
<th class="merchRow">SKU</th>
<th class="merchRow">Special ID</th>
<th class="merchRow">Description</th>
<th class="merchRow">Quantity</th>
<th class="sorttable_nosort">Unit</th>
<th class="sorttable_nosort">Edit</th>
</tr>
</thead>
<tbody>
<?php foreach ($dbh->query($query) as $row) {?>
<tr>
<td style="display: none" class="id"><?php echo $row['ID'];?></td>
<td class="loc"><?php echo $row['Loc'];?></td>
<td class="rp-code" align="center" id="rp-code-<?php echo intval ($row['Rp-Code'])?>"><?php echo $row['Rp-Code'];?></td>
<td class="sku" id="sku-<?php echo intval ($row['SKU'])?>"><?php echo $row['SKU'];?></td>
<td class="special-id" align="center" id="special-id-<?php echo intval ($row['Special-ID'])?>"><?php echo $row['Special-ID'];?></td>
<td class="description" id="description-<?php echo intval ($row['Description'])?>"><?php echo $row['Description'];?></td>
<td class="quantity" align="center" id="quantity-<?php echo intval ($row['Quantity'])?>"><?php echo $row['Quantity'];?></td>
<td class="unit" id="unit-<?php echo intval ($row['Unit'])?>"><?php echo $row['Unit'];?></td>
<td><button type="button" class="edit" name="edit">Edit</button></td>
</tr>
<?php } ?>
</tbody>
</table>
答案 0 :(得分:1)
在Internet Explorer中,contenteditable不能直接应用于TABLE,COL,COLGROUP,TBODY,TD,TFOOT,TH,THEAD和TR元素,内容可编辑的SPAN或DIV元素可以放在单个表格单元格内(见http://msdn.microsoft.com/en-us/library/ie/ms533690(v=vs.85).aspx)。