anchor link w/ query string not working in ie

i need to add an anchor link to the end of a url with a query string

research tells me it should look like this:
http://url?id=querystring#anchor

in my code it looks like this:
#cgi.scriptname#?#cgi.querystring###anchor

the code seems to be working fine, since the url reads fine in the address bar.  but it doesn't move to the anchor.  

here's what i know:
* this only seems to be a problem in ie.  works fine in mozilla and netscape
* if i type the url into the address bar, the anchor does work
* the anchor is far enough down the page to cause it to scroll down, since if i type it in, it works (see above)

any ideas why this wouldn't work???

thanks!




LVL 1
dehfneAsked:
Who is Participating?
 
PluckaCommented:
Hi dehfne,

This is the right topic area, hope I can help. Here is a working example.

http://www.ns.com.au/test.cfm

Here is the code

<cfoutput>
    <cfloop index="count" from="1" to="10">
        <br>
    </cfloop>
    <a href="test.cfm?query=xyz##anchor2" name="anchor1">Go to Anchor 2</a>
    <cfloop index="count" from="1" to="10">
        <br>
    </cfloop>
    <a href="test.cfm?query=xyz##anchor1" name="anchor2">Go to Anchor 1</a>
    <cfloop index="count" from="1" to="100">
        <br>
    </cfloop>
</cfoutput>

Let me know if you have any questions

Regards
Plucka
0
 
pinaldaveCommented:
Hi dehfne,
cover that with <cfoutput></cfoutput> in yoru code it shoudl work then after.


Regards,
---Pinal
0
 
pinaldaveCommented:
Hi dehfne,
sorry for previous mail. you must be using <cfoutput> that should not be the reason.
Can you just try to put with ### (three) pounds and see what it says. I know other expert will critize this but just for try and let us know what it says.

Regards,
---Pinal
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
dehfneAuthor Commented:
the problem isn't with the code.  as i said in my post, the url reads fine in the in the browser address bar.

to be more clear:

(1) if i open the page, the url is:

http://mysite.com/page.cfm?querystring

(2) if i click on the link with the anchor, the url is:

http://mysite.com/page.cfm?querystring#anchor

yet it does not jump to the anchor.

(3) if i open the page (where the url is http://mysite.com/page.cfm?querystring) and type in #anchor at the end (so the url is http://mysite.com/page.cfm?querystring#anchor) and then press return. it does jump to the anchor.

any clues?  perhaps i posted in the wrong forum.  wasn't sure where else to put it.

thanks.
0
 
dehfneAuthor Commented:
oh sorry.  i replied the the first comment while you were replying again...

if i use three ### then it believes there is an extra # and chokes.  as it should.  
0
 
pinaldaveCommented:
Hi dehfne,
very interesting. This may be due to the reason, when the link is there in your url the anchor is not loaded in the page and then after when it complites the loading the page it loads the anchor in your html page but the url is already there so it does not jump but if you put the anchor manually the page is already loaded it will jump to that.
This is what happening. I am thinking the solution now.
What you can do is that... at the end of the page you can do this ...
<cflocation var="http://mysite.com/page.cfm?querystring#anchor"> again and it shoudl work.

Regards,
---Pinal
0
 
dehfneAuthor Commented:
i don't want to have to refresh the page b/c i might losing some information that was posted to it.  but i'll try and see what happens.  thanks.
0
 
mrichmonCommented:
Do you have the anchor defined in the page?

<a name="anchorvalue"></a>

Otherwise this will not work.

Also how are you getting to the page a link? a cflocation?  Can you post the code?

0
 
anandkpCommented:
yeah a look at teh code shld help us figure out what cld be wrong ...
0
 
dehfneAuthor Commented:
i bascially did post the code.  but here it is again.

here's the anchor
<a name="top">&nbsp;</a>

here's the link
<a href="#cgi.SCRIPT_NAME#?#cgi.querystring###top">link</a>

as i said in my above post, the anchor *does work* if i merely add #top to the end of the url in the address bar.  it *does not* work if i click on the link.
0
 
anandkpCommented:
does the source code of this look the same - as u type it in the address bar ?
If yes - then it has to work ...

else try this : <a href="<cfoutput>#cgi.SCRIPT_NAME#?#cgi.querystring#</cfoutput>#top">link</a>
0
 
dehfneAuthor Commented:
please don't tell me that it "has to" work when it doesn't and you haven't even tried it.  it does look exactly the same, and this is why i'm posting here.  i think perhaps its a bug in ie.

i guess i posted to the wrong list.  thanks you all for trying, and i'll let you know if i find anything else out.
0
 
mrichmonCommented:
Here's the problem.

We have tried it.  And it did work for us.  You only gave us a generic link.  If you want us to test your actual page then you need to post the URL and we will check it out.

ALso have you tried using another machine?

Is there enough content BELOW the anchor?

We cannot answer any of these questions because we do not have your actual site.

It is not a bug in IE since it works for all of us.

It may be a bug in your code, but again - without an actual link to test we cannot say for sure.

All the tests we have run with the code you gave DO work in IE and other browsers.
0
 
dehfneAuthor Commented:
i can't seem to get this to work, so i'm giving up.  i can't post the link, since you need an account and i can't give them out.  perhaps that would have helped i don't know...

since no one really was able to help me, but many of you tried, i split the points between the most viable answers.

thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.