473,507 Members | 13,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Ignored anchors in the url query?

Hi there,

I have a guestbook on my site, and it gets opened
in a frame. Every message in the page has it's own
anchor according to the message-number.

Now i've made this thing that i can request the url
in the frame by calling the frameset (index.php)
like this --> index.php?interactive/guestbook/
I detect it with $_SERVER["QUERY_STRING"]

But when i want to call a certain message of the GB,
e.g. message 119, index.php?interactive/guestbook/index.php#119
it doesn't work. the $_SERVER["QUERY_STRING"] seems to
completely ignore the '#' character and anything behind it.

Can it be solved and how?

Thanks a lot!

Greetings Knoak
Jul 17 '05 #1
1 2500
knoak wrote:
But when i want to call a certain message of the GB,
e.g. message 119, index.php?interactive/guestbook/index.php#119
it doesn't work. the $_SERVER["QUERY_STRING"] seems to
completely ignore the '#' character and anything behind it.


That's because anchors have no meaning regarding the retrieval of a page on
a server and are parsed by the browser only.

You can solve this by using another character to identify the anchor and
write a piece of javascript to jump to the desired anchor:

<?

if (isset($_SERVER['QUERY_STRING'])) {
// Location of the page
$location = strtok($_SERVER['QUERY_STRING'], ";");

// Generate a piece of script to jump to the desired anchor
if ($anchor = strtok(";")) {
print "<script>";
print "window.onload = function () { location = '$location#$anchor'; }";
print "</script>";
}
}

?>
<a href="index.php?interactive/guestbook/index.php;119">klik</a>
<?

for ($i = 0; $i < 500; $i++) print "<br />\n";

?>
<a name="119">Hello</a>
JW

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2312
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
2
1604
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
1
2014
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
2
1878
by: learner | last post by:
Hi, A document has many Anchors. I want to take a particular action only if some particular anchors are clicked. I mean if some anchors are clicked, i want an alert box to pop up with ok and...
21
2429
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
2
4875
by: ruben | last post by:
Hi: After upgrading 7.4.2 to 7.4.5 quite smoothly in a Red Hat 8.0 box, we are having intermitent issues with certain online PHP transactions, returning this error: "Warning: pg_exec() query...
12
2354
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of...
3
16527
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A...
1
7029
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
7481
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...
0
5619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5039
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.