469,326 Members | 1,562 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,326 developers. It's quick & easy.

#location

Hello,

I don't know if this is possible, but I think that javascript could solve this. For example, can javascript locate or obtain, hm how to say...

if we have link example.com/page#pagenumber

so that javascript reads link and returns pagenumber?
Feb 20 '08 #1
5 1144
hsriat
1,654 Expert 1GB
Hello,

I don't know if this is possible, but I think that javascript could solve this. For example, can javascript locate or obtain, hm how to say...

if we have link example.com/page#pagenumber

so that javascript reads link and returns pagenumber?
Expand|Select|Wrap|Line Numbers
  1. var anc = location.hash;
  2. //add this line if you have to remove #
  3. anc = anc.replace('#', '');
  4.  
Feb 20 '08 #2
Expand|Select|Wrap|Line Numbers
  1. var anc = location.hash;
  2. //add this line if you have to remove #
  3. anc = anc.replace('#', '');
  4.  
wow, thanks....

we could also use direct replacement :P

Expand|Select|Wrap|Line Numbers
  1. var anc= location.hash.replace('#','');
Feb 20 '08 #3
hsriat
1,654 Expert 1GB
wow, thanks....

we could also use direct replacement :P

Expand|Select|Wrap|Line Numbers
  1. var anc= location.hash.replace('#','');

:D

... I know...
I thought may by you won't need to remove the #... thats why I wrote that comment.
Feb 20 '08 #4
:D

... I know...
I thought may by you won't need to remove the #... thats why I wrote that comment.
does anybody know if I can convert this variable into PHP variable??
Feb 21 '08 #5
hsriat
1,654 Expert 1GB
does anybody know if I can convert this variable into PHP variable??
How do you want to send this variables to PHP?...

If you are using AJAX then it can be sent as it is.
If you have to send it after page submit, then assign this value to a hidden input inside the form.
Feb 22 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

26 posts views Thread by Nige | last post: by
3 posts views Thread by Christian Hubinger | last post: by
4 posts views Thread by tshad | last post: by
6 posts views Thread by G*rd*n | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.