我经常在某些表格数据 (td) 单元格上使用 jQuery 高亮效果。我刚刚意识到,当我使用这个效果时,window.name 值在高亮效果完成后神奇地改变了“data-ec”值。这种行为给我带来了一些问题,因为我需要检查我之前设置的 window.name。
我正在使用如下代码:
<html>
<head>
<script src='jquery-1.6.min.js' type="text/javascript"></script>
<script src='jquery-ui-1.8.12.custom.min.js' type="text/javascript"></script>
<script type="text/javascript">
function PlayIssue() {
//Set Window Name
window.name = 'myWindowName';
// Get RIGHT window name
alert(window.name); // popup shows "myWindowName" as window name
//Play jQuery Effect on TD cell
var myCell = $("#TableID tr[id='row_ID'] td:nth-child(1)");
myCell.effect("highlight", { color: '#FFA500' }, 8000);
//get WRONG window name
alert(window.name); // popup shows "data-ec" as window name
}
</script>
</head>
<body>
<table id="TableID" border="1">
<tr id="row_ID">
<td>cell 1</td>
<td>cell 2</td>
</tr>
</table>
<script type="text/javascript">
//Call JS Function to play issue
PlayIssue();
</script>
</body>
</html>
你对这种行为有什么想法吗?此问题发生在 IE 9/10(仅尝试过这些)上,但不在 Firefox 和 Chrome 上。
提前非常感谢。