what code/command is required to anchor a button for top of page

G

Guest

how can i anchor a button or small graphic to allow a user to return to the
top of a page
 
T

Trevor L.

srork said:
how can i anchor a button or small graphic to allow a user to return
to the top of a page

If the page name is "index.html", try
<a href="index.html" target="_self">top</a>
For an image, replace the text 'top' with an image.

This image could be a a button, but to generate one, use
<input type="button" value="top"
onclick="location.href='index.html'" />

By default, you will locate to the top of "index.html"
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 
T

Trevor L.

Andrew said:
Text link:
<a href="#top">click to return to top</a>

Same idea, but with an image:
<a href="#top"><img src="top.gif"></a>

Hi Andrew,
I also thought of doing this

But it has the (slight) disadvantage that the name (#top) is appended to the
address in the address bar
e.g. on my local web, thw I sue this code, this is what is in the address
bar
file:///C:/Documents%20and%20Settings/Trevor/My%20Documents/My%20Webs/myweb/index.html#top

BTW, it relies on the fact that locating to an non-existent tag (#top) will,
by default, locate to the top of the page.

It also opens a new window (unless you add target="_self" to the <a> tag)

Just by chance I found a script which does the same thing in a few different
ways
http://nl.internet.com/c.html?rtr=on&s=1,2vrr,1,wv6,kax8,400o,74e4

srork,
I hope you get something to work for you - it's a nice idea, and one which I
think adds to the page rather than annoys (as some can).
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 
A

Andrew Murray

Text link:
<a href="#top">click to return to top</a>

Same idea, but with an image:
<a href="#top"><img src="top.gif"></a>
 
G

Guest

Because I don't want to look at code, I highlight my Back Up text or button,
click the hyperlink toolbar button, choose the "Existing File or Web Page"
command, and click to add that page to the Address line.

Andrew, are you saying I could use this
<a href="#top">click to return to top</a>

and no matter which page I put this on, the back up command will go to top?

If so, what a timesaver! Can you explain exactly how I'd use this? If you
can, please tell me precisely where it would go. I know almost zero about
HTML and avoid even looking at it. I'm using FP 2002. Anytime I've tried to
use code someone recommends, it shows up on page in Normal view...and I know
it's something simple I'm doing wrong.

Thanks in advance.
 
M

Murray

Here's the best solution - assume your code is like this -

<body>
<div id="wrapper">
....Lots of content...
<a href="#wrapper">Go to top</a>
 
T

Trevor L.

Worksmart said:
Because I don't want to look at code, I highlight my Back Up text or
button, click the hyperlink toolbar button, choose the "Existing File
or Web Page" command, and click to add that page to the Address line.

Andrew, are you saying I could use this
<a href="#top">click to return to top</a>

and no matter which page I put this on, the back up command will go
to top?

AFAIK, if you add the code
<a href="#top">click to return to top</a>
clicking on the text will go to the top.

This causes the current window to be opened and located to the to the tag
named #top. Because this tag doesn't exist, the default will be the top of
the page.

Note
1. This opens a new page. To reopen the same page, use
<a href="#top" target="_self">click to return to top</a>

2. The reference is actually "index.html#top" (if the page is index.html)
and this will appear in your address bar. To avoid this, use
<a href="index.html" target="_self">click to return to top</a>.
This has the disadvantage that you have to tailor it for each page

I read your statement: "I don't want to look at code", but you want get too
far without understanding at least some HTML code.

It is very easy to add a link such as this. Click on HTML view (I think
that's correct for FP2002) and you will see the code. You will find that
most of is the text that you see displayed. Just find the point where you
want to add the link and paste in the code at this point. That's all there
is to it. (Of course, you have to save the file as usual.)

I also managed to do this using the menu.
Insert: Hyperlink
Address: index.html
Target Frame: same frame
Text: click to return to top
generated this
<a href="index.html" target="_self">click to return to top</a>.

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 
M

Murray

I would not rely on this, Trevor. Did you look at the method I posted?

--
Murray
--------------
MVP FrontPage


Trevor L. said:
Worksmart said:
Because I don't want to look at code, I highlight my Back Up text or
button, click the hyperlink toolbar button, choose the "Existing File
or Web Page" command, and click to add that page to the Address line.

Andrew, are you saying I could use this
<a href="#top">click to return to top</a>

and no matter which page I put this on, the back up command will go
to top?

AFAIK, if you add the code
<a href="#top">click to return to top</a>
clicking on the text will go to the top.

This causes the current window to be opened and located to the to the tag
named #top. Because this tag doesn't exist, the default will be the top of
the page.

Note
1. This opens a new page. To reopen the same page, use
<a href="#top" target="_self">click to return to top</a>

2. The reference is actually "index.html#top" (if the page is index.html)
and this will appear in your address bar. To avoid this, use
<a href="index.html" target="_self">click to return to top</a>.
This has the disadvantage that you have to tailor it for each page

I read your statement: "I don't want to look at code", but you want get
too far without understanding at least some HTML code.

It is very easy to add a link such as this. Click on HTML view (I think
that's correct for FP2002) and you will see the code. You will find that
most of is the text that you see displayed. Just find the point where you
want to add the link and paste in the code at this point. That's all there
is to it. (Of course, you have to save the file as usual.)

I also managed to do this using the menu.
Insert: Hyperlink
Address: index.html
Target Frame: same frame
Text: click to return to top
generated this
<a href="index.html" target="_self">click to return to top</a>.

--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
T

Trevor L.

Murray said:
I would not rely on this, Trevor. Did you look at the method I
posted?

Hi Murray,

I was replying to various posts in the stream and in the end I thought the
best way was
<a href="index.html" target="_self">click to return to top</a>.

Is this what you would recommend?
or is this better
<a href="#top" target="_self">click to return to top</a> ?
or even
<a href="index.html#top" target="_self">click to return to top</a>
(where the page is index.html)?

By now, the OP has probably decided what to use anyway

I don't use a top link much myself, but I tried the first one on my site and
it seems to work OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 
M

Murray

No. I had this code -

<body>
<div id="wrapper">
....
<a href="#wrapper">Back to top</a>

--
Murray
--------------
MVP FrontPage


Trevor L. said:
Murray said:
I would not rely on this, Trevor. Did you look at the method I
posted?

Hi Murray,

I was replying to various posts in the stream and in the end I thought the
best way was
<a href="index.html" target="_self">click to return to top</a>.

Is this what you would recommend?
or is this better
<a href="#top" target="_self">click to return to top</a> ?
or even
<a href="index.html#top" target="_self">click to return to top</a>
(where the page is index.html)?

By now, the OP has probably decided what to use anyway

I don't use a top link much myself, but I tried the first one on my site
and it seems to work OK
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
T

Trevor L.

Murray said:
No. I had this code -

<body>
<div id="wrapper">
...
<a href="#wrapper">Back to top</a>

Great,
Now I recall. And I am only 65. I thought my memory recall wouldn't
disappear so soon :))

Of course, this is the solution that resolves every problem, except that
each page has to be altered to add the <div>
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
----------------------------------------
 
M

Murray

It should be there anyhow! 8)

--
Murray
--------------
MVP FrontPage


Trevor L. said:
Murray said:
No. I had this code -

<body>
<div id="wrapper">
...
<a href="#wrapper">Back to top</a>

Great,
Now I recall. And I am only 65. I thought my memory recall wouldn't
disappear so soon :))

Of course, this is the solution that resolves every problem, except that
each page has to be altered to add the <div>
--
Cheers,
Trevor L.
[ Microsoft MVP - FrontPage ]
MVPS Website: http://trevorl.mvps.org/
 
T

Thomas A. Rowe

In my experience, the answer is yes, but as Trevor indicated "#top" will be appended to the URL in
the address bar.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage

http://www.Ecom-Data.com
==============================================
 
M

Murray

It is not consistent with my experience, though. At the moment, I do not
recall which browser it fails in....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top