<SCRIPT language=javascript>
function setPos(id){
var hs=document.location.hash
if(hs==null || hs=="" ||hs=="#"){
document.location.hash=document.location.hash+id
}else{
document.location.hash=document.location.hash+"&"+id
}
}
function delPos(){
document.location.hash=""
}
</SCRIPT>
function setPos(id){
var hs=document.location.hash
if(hs==null || hs=="" ||hs=="#"){
document.location.hash=document.location.hash+id
}else{
document.location.hash=document.location.hash+"&"+id
}
}
function delPos(){
document.location.hash=""
}
</SCRIPT>
本文介绍了一种通过JavaScript实现的页面元素定位方法。该方法能够根据当前URL的hash值来添加或移除指定ID,从而实现页面内容的精确跳转。文章详细解释了如何使用JavaScript操作URL的hash部分,并提供了具体实现的源代码。
6471

被折叠的 条评论
为什么被折叠?



