我给连接加了个id,加了个事件onContextMenu<a id="download123" href="#" onContextMenu="return downLoad(totalRecord,'${rc.contextPath}/commonquery.do?method=downLoad');" onclick="downLoad(totalRecord,'${rc.contextPath}/commonquery.do?method=downLoad');">下载 </a> 
js中只做验证,通过验证修改 a.href值
function downLoad(flag, url) {
/*获取下载的链接元素*/
var obect = document.getElementById("downloadresult");
if (0 == flag) {
alert("没有记录,不能下载");
return false;
} else if(10000 < flag) {
alert("您下载的记录数超过了10000条,请更改查询条件,重新查询并下载!");
return false;
}
/*如果满足条件,将链接的href属性值设置为请求的url*/
obect.href = url ;
}