For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > March 2005 > Internal links with cgi









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Internal links with cgi
Ankur Gupta

2005-03-26, 3:55 pm

Hi,



I have a link like this. <a href="http://127.0.0.1/link.cgi#word">word</a>.



When I click on the link word, I want the link.cgi to execute and then it
should navigate to the word "word".



Link.cgi is executed and everytime it navigates to the top of the page
instead of navigating to the word "word".

Its not happening for me. Is it valid in cgi or am I missing something.



Thanks,

Ankur




Bill Stephenson

2005-03-26, 3:55 pm

On Mar 26, 2005, at 11:41 AM, Ankur Gupta wrote:

> Hi,
>
>
>
> I have a link like this. <a
> href="http://127.0.0.1/link.cgi#word">word</a>.
>
>
>
> When I click on the link word, I want the link.cgi to execute and then
> it
> should navigate to the word "word".
>


This sounds like a job for Javascript. You can probably do this with an
"onload" command and I suppose it's a simple script at that, but I
don't have an example handy. Shouldn't be too hard to find one
though...

Kindest Regards,

--
Bill Stephenson

Ankur Gupta

2005-03-26, 8:55 pm

Thanks David and Bill ...
Using named anchors it worked.. I do not care about old versions of
explorers.

--
Ankur

-----Original Message-----
From: David Dorward,,, [mailto:david@us-lot.org] On Behalf Of David Dorward
Sent: Saturday, March 26, 2005 11:17 PM
To: Ankur Gupta
Cc: beginners-cgi@perl.org
Subject: Re: Internal links with cgi

On Sat, Mar 26, 2005 at 11:11:15PM +0530, Ankur Gupta wrote:

> I have a link like this. <a

href="http://127.0.0.1/link.cgi#word">word</a>.

> When I click on the link word, I want the link.cgi to execute and then it
> should navigate to the word "word".


Then wrap that word in a named anchor or (if you are writing modern
code and don't need to support browsers as obsolete as Netscape 4) a
suitable element with an id.

> Its not happening for me. Is it valid in cgi or am I missing something.


All the browser knows is that it has recieved some HTML because it
made a request for an HTTP resource. It doesn't matter how the server
goes about working out what content to send back, CGI, mod_perl, a
static file, its all the same to the client.

--
David Dorward http://dorward.me.uk



Felix Geerinckx

2005-03-26, 8:55 pm

On 26/03/2005, Ankur Gupta wrote:

> <a href="http://127.0.0.1/link.cgi#word">word</a>.
>
> When I click on the link word, I want the link.cgi to execute and
> then it should navigate to the word "word".


Add a name="word" attribute to you anchor element:

<a name="word" href="....">word</a>

--
felix
David Dorward

2005-03-26, 8:55 pm

On Sat, Mar 26, 2005 at 11:11:15PM +0530, Ankur Gupta wrote:

> I have a link like this. <a href="http://127.0.0.1/link.cgi#word">word</a>.


> When I click on the link word, I want the link.cgi to execute and then it
> should navigate to the word "word".


Then wrap that word in a named anchor or (if you are writing modern
code and don't need to support browsers as obsolete as Netscape 4) a
suitable element with an id.

> Its not happening for me. Is it valid in cgi or am I missing something.


All the browser knows is that it has recieved some HTML because it
made a request for an HTTP resource. It doesn't matter how the server
goes about working out what content to send back, CGI, mod_perl, a
static file, its all the same to the client.

--
David Dorward http://dorward.me.uk

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com