我希望在单击事件中,能够将锚点名称“#on”附加/删除到当前URL中,而不需要重新加载页面,或者使用链接中的href =“#on”,因为它会使我的页面跳转
例如:http://www.example.com/page.html#on,这样我就可以检测访问该URL的用户并调用On()函数。
function On()
{
//append to current url the anchor "#on"
}
function Off()
{
//remove from the current url the anchor "#on"
}
$('.on').live('click', function() {
On();
return false;
});
$('.off').live('click', function() {
Off();
return false;
});