链接<a>标签传值到后台

我原来做了一个根据日期查询的表单,把选中的日期传值到后台jsp页面!
现在需要把日期选择框改成12个月份对应的<a>标签链接和一个年份下拉列表!我怎么才能从这12个月份对应的<a>标签和下拉列表里面拿到对应日期然后传值给后台对应的jsp页面…………
<td width="10%" background="/img/sx_05.jpg" align="center"><select name="select" id="select" >
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
</select>
</td>
<td> <a href="/cps/ktgg.jsp?riqi=2011-01-01">1月</a></td>
<td> <a>2月</a></td>
<td> <a>3月</a></td>

就是怎么能让a标签里面那个2011年根据select的值进行改变!

第1个回答  推荐于2016-07-09
用JS
function doSelect(selectId){
//得到table行,rowIndex为行数(从0开始)
var rowIndex = 0;
var rowObj = document.getElementsByTagName('table')[0].rows[rowIndex ];
var tds = rowObj.childNodes;
for(var i=1;i<tds.length;i++){
var tdObj = tds[i];
if(tdObj.nodeName == 'TD'){
for(var j=0;j<tdObj.childNodes.length;j++){
var aObj = tdObj.childNodes[j];
if(aObj.nodeName == 'A'){
var s_href = aObj.href;
var s_year = s_href.split('?')[1].split('=')[1].split('-')[0];
var t_year = document.getElementById(selectId);
aObj.href = s_href.replace(s_year,t_year);
}
}
}
}
}本回答被提问者采纳
相似回答