473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

#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 1308
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

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

Similar topics

26
by: Nige | last post by:
I'm a complete novice to JS. I want to insert the date and time into a document in the format: WB-MMDDHHmm Where: WB- is a fixed string prefix (the whole string is a reference number) MM...
5
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and...
3
by: saiho.yuen | last post by:
Hi, Is anyone know what is the difference between Location.href and Window.location.href Thanks you very much:) Saiho
8
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) {...
3
by: Christian Hubinger | last post by:
Hi! I'm working on a page that uses javascript very much. My problem is now that i cannot redirect to another page in IE with window.location =<URL>; This command gets executed (proofed with...
4
by: tshad | last post by:
Can I set up multiple pages in the same Location tag? I thought I saw somewhere that I could. I tried the following, but it doesn't work. ***************************************************...
6
by: G*rd*n | last post by:
I have been using the HTTP "Location" reponse header to direct a symbolic request to a CGI program to an actual URL/file. For example, let us suppose the CGI program's table indicates xyz ->...
1
by: Marc the Demi-Programmer | last post by:
I am overriding WncProc to make sure my form's location stays within specified parameters. Basically, it has to stay at the top of the screen and not be off to either of the sides. All that works...
6
by: Marcolino | last post by:
Hi all, I have a simple problem but I don't know which is the best way to solve it. I need to savo into a table into access DB the location and the size of a form. Is there a way to save...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I placed a button on a form menustrip for the purpose of causing the horizontal scrollbar of my form to appear so that I can access controls outside of the form's current view (the controls are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.