From: Linda on
<input type="button" value="Back" onClick="javascript:
history.go(-1)">

In the previous page, the link to the current page is at the bottom of
the page. When I hit the back button on the current page, when the
previous page loads, it opens near the bottom of the page (where the
link is located). Is there a way to make the previous page open at
the top of the page using the onclick of this button?

Linda
From: David Mark on
On Aug 9, 12:51 am, Linda <1anml...(a)gmail.com> wrote:
> <input type="button" value="Back" onClick="javascript:
> history.go(-1)">

That should be avoided, meaning both the "javascript:" label (which
does nothing here) and the use of the history.go method.

>
> In the previous page, the link to the current page is at the bottom of
> the page.  When I hit the back button on the current page, when the
> previous page loads, it opens near the bottom of the page (where the
> link is located).  Is there a way to make the previous page open at
> the top of the page using the onclick of this button?
>

Yes, if you know the address of the previous page you could set
window.location.href. Of course, then you could use a static link
instead of a scripted button.
From: Garrett Smith on
On 2010-08-08 09:51 PM, Linda wrote:
> <input type="button" value="Back" onClick="javascript:
> history.go(-1)">
>
Don't use javascript URIs.
<http://jibbering.com/faq/#javascriptURI>

What if it is an off-site link, or if there is no referring link?

A link is the way to go; you'll need some sort of server side logic to
get that URI.

> In the previous page, the link to the current page is at the bottom of
> the page. When I hit the back button on the current page, when the
> previous page loads, it opens near the bottom of the page (where the
> link is located). Is there a way to make the previous page open at
> the top of the page using the onclick of this button?
>
What for? That sounds like a broken experience.
--
Garrett
From: Garrett Smith on
On 2010-08-08 10:56 PM, Garrett Smith wrote:
> On 2010-08-08 09:51 PM, Linda wrote:
>> <input type="button" value="Back" onClick="javascript:
>> history.go(-1)">
>>
> Don't use javascript URIs.
> <http://jibbering.com/faq/#javascriptURI>
>

Sorry, that was not a javascript uri you used; but a meaningless label.
You don't need that label and if you use a real link (as I suggested in
my previous message) you're much better off.
--
Garrett
From: Linda on
OK. I get it that no one here thinks that this is a good idea. But,
without going into a long description of the "why" I want to do this,
is there a way to return to the top of an unknown page with a link or
with a button rather than to the point of the link on the referring
page?

Linda