[为防止误导,重新编辑了一下问题,不好意思!]
通过js代码或者jquery实现:
1、点击class=a的连接时,访问https://www.aaaaaa.com/?page=n
2、点击class=b的连接时,访问https://www.bbbbbb.com/?page=n
运行环境是这样的,还请再看一下哈。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>简约表格插件</title>
<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
<script src="https://www.jq22.com/demo/jquerytablePlugin201901132312/js/tableXR.js"></script>
</head>
<body>
<div id="root" style="width: 800px"></div>
<script type="text/javascript">
$('#root').tableXR({
//表格标题
title:'学生成绩列表',
//表格头部设置
columns:[
{data:'name',title:'名字'},
{data:'age',title:'年龄'},
{data:'store',title:'得分'},
{data:'level',title:'等级'},
{data:'detal',title:'详情'},
],
//表格数据:
data:[
{name:'小红',age:'18',store:'98',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'小化',age:'18',store:'97',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'小杰',age:'15',store:'95',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'小刚',age:'17',store:'95',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'大水',age:'23',store:'97',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'小胡',age:'22',store:'88',level:'B',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'热热',age:'19',store:'90',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'二娃',age:'17',store:'92',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'小瑟',age:'16',store:'89',level:'B',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'滑板',age:'15',store:'91',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'Dddd',age:'17',store:'95',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'DSDd',age:'17',store:'95',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
{name:'DSDa',age:'17',store:'95',level:'A',detal:'<a class="a" href="/?page=1">详情a</a>'},
{name:'DSDb',age:'17',store:'95',level:'A',detal:'<a class="b" href="/?page=1">详情b</a>'},
]
})
</script>
</body>
</html>
<script>
var aList = document.querySelectorAll('a');
aList.forEach((e, index) => {
base_href = e.href.substr(e.href.lastIndexOf("/") + 1);
if (e.className == 'a') {
e.setAttribute('href', "https://www.aaaaaa.com" + base_href);
} else if (e.className == 'b') {
e.setAttribute('href', "https://www.bbbbbb.com" + base_href);
}
})
</script>