1、锚点跳跃
HTML:
<div class="page_title" ?id="maodian"> ???<h1>客房节日价格管理</h1></div><td><a ref="{$v[‘h_id‘]}" ?href="javascript:void(0);" class="button"><span class="trash icon"></span>编辑</a> ???//2、href不加跳跃,在下面js有其他事件(ajax)</td>
JS:
<script type="text/javascript"> ???$(function(){ ???????$("td a").click(function(){ ?????????? $(this).attr(‘href‘,"#maodian");//瞄点链接替换,非常重要 ???????????var h_id = $(this).attr("ref"); ???????????//alert(h_id); ???????????if(h_id){ ???????????????//同步ajax的POST方式进行请求数据 ???????????????$.ajax({ ???????????????????????????????????//... ???????????????}); ???????????}else{ ???????????????alert(‘请选择有效的房间id‘); ???????????????} ???????}) ???})</script> ???
<a>标签实现锚点跳跃,<a>标签实现href不跳跃另外加事件(ref传参)
原文地址:http://www.cnblogs.com/xuzhengzong/p/7645403.html