我有这个页面:
<html>
<head>
<body text="#000000" marginwidth="0" marginheight="0" bgcolor="#FFFFFF" onload="" topmargin="0" leftmargin="0">
<style type="text/css">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center" style="page-break-after:always;">
<table width="100%" cellspacing="0" cellpadding="0" align="center">
</body>
</html>
我需要为每个父表添加唯一的 ID。问题是,这些表中的每一个都有许多嵌套表。我只需要为显示的每个添加 ID。我该怎么做?我试过了:
jQuery("table").each(function(count){
var count = count + 1;
jQuery(this).attr("id","table"+count+"");
});
但这会为所有表添加唯一 ID,甚至是嵌套表。任何帮助,将不胜感激。