Discussion Locked

ASP issue.

0 helpful
9 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

In html, you can write a link that will redirect a user to a certain area of a page using a bookmark (http://www.blah.com#bookmark). How can I do this in ASP when I am passing variables from a form or to a document.

Example: I have a link that says something like: "www.blah.com/articles.asp?var=value&bookmark=4"

When you pass variables, it doesn't let you use #bookmark, I think you have to trap a variable and do something else.. but I don't know how to program it, if it can be done in ASP, or if it can be done in JAVA, but I at least know it can be done.

9 replies

by jay eckles

I thought a URL like http://www.blah.com/articles.asp#bookmark?var=value would work, but after a little testing, it appears not - var=value gets lost.

The only solution I can think of is to include some Javascript that will automatically scroll the page down to a predetermined spot. You can set that spot using one of the parameters passed to the ASP. There are tons of code examples on how to use Javascript for autoscrolling features - just hop on over to your favorite JS archive.

Good luck.

Jay Eckles

by sixfourtykilo

I haven't been able to find any javascript that will allow this. The focus() is basically worthless as you can't seem to use it with ASP variables and any other autoscroll feature of java requires an x,y position which is also useless.

Thanks anyway!!

by cbarest

How about dropping a hidden field on that page and instead of passing the argument & value, have the target page GET the value from the hidden field ?
Could get messy, but you could drop it in a cookie and pick the value back up on the other side....
I'll look into it - should be pretty easy without java...
- Chuck

by sixfourtykilo

I'm waiting on you to post back with whatever you have found. I'm not as familiar with the GET as I am the POST (haven't used it), but the whole cookie then and using that sounds far too messy and over-complicated. There has to be an "easy" solution.

by sixfourtykilo

I couldn't find anything in JAVA that would be useful to me as all of the "focus" events required a specific X,Y location on the screen which is nearly impossible to determine with a varying amount of text, etc. I just need a simple way to reference a bookmark. I see something similar passed on other pages like a variable called GOTO and the page ends up where it should.. its all very frustrating.

I thought I had something with onload="object.document.focus()" but that only works with input entries and what-not.

by sixfourtykilo

Here are some additional notes if you are confused: lets say you visit a forum (Example: techrepublic or incrontic). In that forum, there may be a link that says, "Go to first unread post". Regardless of what page you are on, you click that link,it takes you to the correct page, and, not only that, but it also brings you to that very post that is "new" (which may be 20 posts down the page). Clear as mud?

This discussion is closed to new replies.