1.寫入<a>標簽:
<a target="_blank" href="javascript:void(0)" onclick="checkValidate()">水覓微博</a>
2.加入JS:
. 代碼如下:
<script type="text/javascript">
function checkValidate(){
if($("#signOut").text()){
window.location.href="<%=basePath%>/jsp/weibo/index.jsp";
}else{
window.location.href="<%=basePath%>index.jsp";
}
}
</script>
3.解釋:
$("#signOut").text()為我所需要判斷的對應ID的Html元素的值