Forum Moderators: open
I have a section on one of my sites where users can leave comments about an article. After they place a comment (or update their comment) they are redirected to where it is on the page. Next to their comment I have
<a name="commentxx"></a>Where xx is the message number
in the code.
After they add on update the url they are redirected to is
http://domain.com/article.asp?t=yyyy#commentxxWhere xx is the comment id (the same as above) and yyyy is the article id
The problem is, it does not scroll to the comment. The page loads as normal with the user placed at the top of the page. The only thing I can think of is that it doesn't work with querystrings in the url.
Is this the case? If not, can anyone see what is going wrong?
Chris
[domain.com...]
Where xx is the comment id (the same as above) and yyyy is the article id
I think it should be like this:
[domain.com...]
i.e. bookmark straight after page name then then querystring
Suzy
Yes you're right I'm sorry, I just remebered having the same problem and this was one of the things I triad at the time
however I have now tested it and your original format is correct and it's working crossbrowser for me..
However in my test I caused it not to work by not having the quotes in the script correct
You might want to check that? when you hover over the link is the status bar showing you the correct link address including the bookmark?
or post the line of code that's generating the URL and bookmark, Maybe there's an error in it?
Sorry for misinformation before..
Suzy
I meant the ASP code (sorry I know this isn't the right board)
code should be like this:
response.write "<a href=""articles.asp?id=" & objRS("ArtID") & "#msg" & objRS("msgID") & """>"
I got all confused with my quotation marks at the end....
:) and that's what was causing my error and I wondered if it's the same for your links?
Suzy
I think if you use session variables it will work. Do something like the code below at the top of your page - you probably have to modify it a bit.
Note: Simply call session("t") and session("message") on your SQL code (if you need to), instead of request("t") and request("messagenumber"), also, in the body write the anchor as <a name="<%=session("anchor")%>"></a>
<%
if request("messagenumber")<>"" then
Dim anchor
anchor = "comment" & request("messagenumber")
session("t") = request("t")
session("anchor" )= anchor
session("message" )= request("messagenumber")
response.redirect "article.asp" & "#" & anchor
end if
%>
good luck