jsp页面href=#与href=javascript:void(0)的区别

#"包含了一个位置信息
默认的锚点是#top 也就是网页的上端
而javascript:void(0)  仅仅表示一个死链接
所以调用脚本的时候最好用void(0)
或者<input onclick>
<div onclick>等
<a  href="javascript:void(0)" οnclick="openWin(3,this)">LINK_TEST</a>
window.location.href=""




//div[@id='yy']//div[@class='TRS_Editor']
<c:set var="sum_price" value="0"></c:set> <!-- 定义一个变量来存储商品数量 --> <c:set var="goods_count" value="0"></c:set> <!-- 定义一个变量来存储,购物车的id集合 --> <c:set var="tids" value="#"></c:set> <c:forEach items="${trolleys }" var="trolley"> <c:set var="tids" value="${tids }#${trolley.tid }"></c:set> <div class="tro_tab_h1"> <div class="col tro_tab_check"> <span class="tro_tab_check_sp"></span> </div> <div class="col tro_tab_img"> <img src="<%=imgPath %>${trolley.goods.pic }" alt=""> </div> <div class="col tro_tab_name"> <li class="tro_tab_name_li1" style="font-size: 16px;">${trolley.goods.gname } ${trolley.goods.color }</li> </div> <div class="col tro_tab_price"> <span id="price">${trolley.goods.price }</span><span>元</span> </div> <div class="col tro_tab_num"> <a class="tro_tab_num_p1" id="subtract" href="javascript:void(0)" onclick="addOrDeleteNumber(${trolley.tid}, ${trolley.number - 1 })">-</a> <input type="text" value="${trolley.number }" id="num"> <c:set var="goods_count" value="${goods_count + trolley.number }"></c:set> <a class="tro_tab_num_p2" id="plus" href="javascript:void(0)" onclick="addOrDeleteNumber(${trolley.tid}, ${trolley.number + 1 })">+</a> </div> <div class="col tro_tab_total "> <c:set var="sum_price" value="${sum_price + trolley.goods.price * trolley.number }"></c:set> <span class="tro_tab_total_value" id="prices" >${trolley.goods.price * trolley.number }</span>元 </div> <div class="col tro_tab_action" style="cursor: pointer;width: 40px;height: 40px;" onclick="deleteTrolley(${trolley.tid })">删除</div> </div> </c:forEach>
06-07
<h3>新闻发布系统>>新闻管理>>查询新闻</h3> <center> <form action="SelectNews" method="post"> 请输入查询条件:<input type="text" name="key"> <input type="submit" value="查询"> </form><br> <table border="1" width="70%" cellpadding="0" cellspacing="0"> <tr align="center"> <td>编号</td> <td>标题</td> <td>类型</td> <td>发布人</td> <td>发布日期</td> <td>状态</td> <td>是否头条</td> <td colspan="4">操作</td> </tr> <c:forEach items="${newsList }" var="news"> <tr align="center"> <td><input type="checkbox" name="newsIds" value="${news.nid}"></td> <td>${news.nid }</td> <td>${news.title }</td> <td>${news.type }</td> <td>${news.userName }</td> <td>${news.pubtime }</td> <td> <c:choose> <c:when test="${news.state==0 }">待审核</c:when> <c:when test="${news.state==1 }">通过</c:when> <c:otherwise>未通过</c:otherwise> </c:choose> </td> <td> <c:choose> <c:when test="${news.top==0 }">否</c:when> <c:otherwise>是</c:otherwise> </c:choose> </td> <td>${news.top==0?"是":"否" }</td> <td> <a href="NewsDetail?nid=${news.nid }&op=show">查看</a> <c:if test="${user.rule==0 || user.uid ==news.uid }"> <a href="NewsDetail?nid=${news.nid }&op=update">修改</a> </c:if> <c:if test="${user.rule==0 }"> <a href="newsDelete.jsp?nid=${news.nid }"> 删除</a> </c:if> <c:if test="${user.rule==0 }"> 审核</c:if> </td> </tr> </c:forEach> </table> <button type="button" ><a href="javascript:void(0)" onclick="banchDelete()">批量删除</a></button> </center> </body> <script type="text/javascript"> function banchDelete(){ var idsArray = document.getElementsByName("newsIds"); var nidArray=[]; for(k in idsArray){ if(idsArray[k].checked){ nidArray.push(idsArray[k].value); } } if(nidArray.length==0){ alert("请选择要删除的新闻"); return } window.location.href="./newsBanchDelete.jsp?nids="+nidArray.join(","); } </script>这段代码优化使user.rule=0的用户才能看见批量删除的按钮
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值