English 中文(简体)
JQuery - 查阅网页?
原标题:JQuery - get page?
  • 时间:2010-06-21 09:46:52
  •  标签:
  • jquery

我几乎已经这样做,但没有足够大脑力来完成最后步骤。

这是目前发生的情况。

1) Page loads 2) When a link is clicked, a hash is added to the url with the page id. This is saved to the browser history.

如果我把Ajax电话附在连接功能上,那我就会听起来。 问题正从ur中getting。 这里是我所拥有的。

var id = urlToId(window.location);
if (id != undefined) {
    go(id);
}

function urlToId(url) { alert(url);
    var segments = url.split( # ); alert(segments);
    var id = segments[1];
    return id;
}

alert(url) = http://localhost/site/index.php?p=1#1 -- Javascript Error: url.split is not a function.

我感到,如果我能刚刚摆脱贾瓦文的错误,那我就应该成为黄金。

最佳回答

为此:

function urlToId() {
    return window.location.hash.substr(1);
}
问题回答

你的圆顶参数指的是窗户。 地点标的无分立功能(并非直线)。

取而代之,Try window. place.hash,这只是从编号起就算。 而不是窗口。 标 点

var id = hashToId(window.location.hash); 
if (id != undefined) { 
    go(id); 
} 

function hashToId(hash) {
    return hash.slice(1); // remove the leading #
} 




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签