PDA

View Full Version : How can i move to the bottom of the page after response.redirect?


BarrMan
12-04-2005, 03:26 PM
i have a problem moving to the bottom of the page after response.redirect:
response.redirect "showthread.asp?id=" & request.querystring("id") & "&fid=" & request.querystring("fid") & "#bottom"
What can i do to get this work?

pramsey
12-05-2005, 03:59 AM
Are you trying to focus your visitors on something that you have at the bottom of the page, like an ad? If so, consider this. #bottom is calling a section of your site named bottom. You can try wrapping your ad or whatever is at the bottom of the page in


<a name=bottom></a>



so your code should look like this

<a name=bottom>here is the ad or whatever you want your visitors to see</a>

BarrMan
12-05-2005, 09:33 AM
thx for the reply but i know how to do that.. .the problem is with the response.redirect with the fid and id variables.

Roelf
12-05-2005, 10:36 AM
have you tried to change the order?
response.redirect "showthread.asp#bottom?id=" & request.querystring("id") & "&fid=" & request.querystring("fid")

BarrMan
12-05-2005, 10:37 AM
yes, didn't work.

zenweezil
12-05-2005, 07:45 PM
Are you able to manually type in a url that achieves what you want to occur?

If so, does that url and the url created by the response.redirect differ in any way?

Just a thought.

BarrMan
12-05-2005, 07:57 PM
i can't do it manually or automatically cuz in the sql it says "SELECT * FROM forum#" & request.querystring("fid") & " WHERE id=" & request.querystring("id")
so it'll go or to forum#1#bottom or to 1#bottom.

BarrMan
12-15-2005, 11:26 AM
ideas anyone?

glenngv
12-20-2005, 07:54 AM
Your code should work.
response.redirect "showthread.asp?id=" & request.querystring("id") & "&fid=" & request.querystring("fid") & "#bottom"
Are you sure you have an anchor named bottom in the page?
<a name="bottom"></a>
You can test it manually by copying the url generated in the redirection and then pasting it in the address bar.

BarrMan
12-20-2005, 11:00 AM
Yes, i'm sure, but it counts my forum#14 as forum#14#bottom too... i really don't know what is the reason and how to solve it.

Can anyone help me?

TheShaner
12-20-2005, 03:10 PM
I know what you mean. You'll have a URL as:

http://myforums.com/showthread.asp?id=4&fid=10#bottom

And when you grab the value of fid, you get 10#bottom, which will screw up your SQL query.

You have two options, and the first one i give you should work, hehe. The second one seems easier, but I really don't know if it'll work.

1) When you grab the value of fid, use a function to remove that part:
Function removeAnchor(id)
Dim position
position = InStr(id, "#")
If position = 0 Then
removeAnchor = id
Else
removeAnchor = Left(id, position)
End If
End Function
SQL Query:
"SELECT * FROM forum#" & removeAnchor(request.querystring("fid")) & " WHERE id=" & request.querystring("id")

2) Do something like:
Response.Redirect "showthread.asp?id=" & request.querystring("id") & "&fid=" & request.querystring("fid") & "&#bottom"
-OR-
Response.Redirect "showthread.asp?id=" & request.querystring("id") & "&fid=" & request.querystring("fid") & "&b=1#bottom"
In number 2, I'm not sure if the 1st example will work, but the second one will. Of course, you won't be grabbing the value of b. It's just there to separate the fid from the #bottom anchor so that the fid doesn't the #bottom as part of the value.

-Shane

BarrMan
12-20-2005, 04:08 PM
Thanks alot! i'll try that later

glenngv
12-22-2005, 07:51 AM
2) Do something like:
Response.Redirect "showthread.asp?id=" & request.querystring("id") & "&fid=" & request.querystring("fid") & "&#bottom"
In number 2, I'm not sure if the 1st example will work, ...
That will work.

BarrMan
12-22-2005, 12:33 PM
Thank alot everyone! thanks glenngv! it worked!