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元素的值
<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元素的值
网友评论文明上网理性发言已有0人参与
发表评论: