我必須將網站從html傳遞到xhtml,因爲需要包含svg。使用jQuery 1.4.4和Firefox在xhtml文檔中添加表中的行
由於此更改,我無法在表中添加行。
環境:火狐3.6.12與螢火蟲和jQuery 1.4.4
單元測試:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a.addrowb").click(function(){
$("table tbody").append("<tr><td>new row on bottom</td><td></td></tr>");
return false;
})
$("a.addrowt").click(function(){
$("table tbody").prepend("<tr><td>new row on top</td><td></td></tr>");
return false;
})
})
</script>
<title>Untitled Document</title>
</head>
<body>
<a class="addrowb" href="#">Add row In the bottom</a> <a class="addrowt" href="#">Add row In the Top</a>
<table border="1">
<tbody>
<tr>
<td>Text 1</td><td>text 2</td>
</tr>
</tbody>
</table>
</body>
</html>
你'了'標籤不具備相關的類。這可能是問題嗎? – lonesomeday 2010-11-18 08:17:35
你的權利,我修好了樣品。但問題仍然在這裏 – mruellan 2010-11-18 08:22:32
適用於所有瀏覽器,我可以設置一個測試頁,以便我可以檢查嗎? – tbleckert 2010-11-18 08:36:13