链接的 onclick 事件被先执行,其次是 href 属性下的动作(页面跳转,或 javascript 伪链接);
目的:点击<a>标签,调用动态变更<a>href的js方法后跳转到指定链接
<c:forEach var="example" items="${exampleList }" varStatus="status">
<li class="am-g am-list-item-dated title">
<a id="pdf${status.count }" οnclick="javascript:pdfview('pdf${status.count }','${example.rptPathname }')" class="am-list-item-hd ">
<input type="hidden" id="rptpath${status.count }" value="${example.rptPathname }">
<div class="am-u-sm-1"><i class="fa fa-file-text"></i></div>
<div class="am-u-sm-4"> ${example.rptTitle }</div>
<div class="am-u-sm-4"> <fmt:formatDate value='${example.rptReportdate }' pattern="yyyy-MM-dd"/></div>
<div class="am-u-sm-1"> ${example.rptReportingphy }</div>
<div class="am-u-sm-1"><i class="fa fa-angle-right Qu_i_right"></i></div>
</a>
</li>
</c:forEach>
function pdfview(idobj,pathobj){
if (isMobile.any()) {
$('.main_header').hide();
}
if (isMobile.Android()) {
$("#"+idobj).attr("href","assets/js/pdfJs/generic/web/viewer.html?file="+pathobj);
}
if (isMobile.iOS()) {
$("#"+idobj).attr("href",pathobj);
}
}