Reply
Return to top HTML code
Old 01-12-2008, 10:50 PM Return to top HTML code
Novice Talker

Posts: 10
Hello and thanks in advance,

I have in some sections of the page some links to "return to the top of the page".

It works perfectly with IE but not in firefox.

Can you please tell me what's wrong?

<a href="#top-top" target="_self">Return to top</a>


Thanks/regards
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 01-12-2008, 11:32 PM Re: Return to top HTML code
Skilled Talker

Posts: 52
Name: Dustin
Well, I'm not sure about IE, but I know that in firefox you don't need the: target="_self" part. Technically I don't see why you would need it in IE either, although IE is quirky sometimes so who knows. Hope that helps.
__________________

TributeK is offline
Reply With Quote
View Public Profile
 
Old 01-12-2008, 11:49 PM Re: Return to top HTML code
Novice Talker

Posts: 10
Nope, it didn't work...
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
Old 01-12-2008, 11:54 PM Re: Return to top HTML code
Skilled Talker

Posts: 52
Name: Dustin
Oh yeah, forgot to ask. Did you make an anchor point at the top of your page? I think it's called an anchor point. Pick the first word at the top of the page. EX: <a name="top-top">firstword</a>. your href="#top-top" should work then.

I know that if you don't want that firstword to look like a link, and this works in firefox, can't say for other browsers, that you can put: <a name="top-top"></a>firstword :which makes firstword an anchor point without making it appear to be a link. Does this work for you? Also, can I view your page?
__________________

TributeK is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 12:20 AM Re: Return to top HTML code
Novice Talker

Posts: 10
Yes I did. The thing is that EVERYTHING works just fine in IE but not in firefox.
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 12:32 AM Re: Return to top HTML code
Skilled Talker

Posts: 52
Name: Dustin
Sounds fishy to me. I just tested this out on my blog. Try it on my homepage.
All I did was put this in the horizontal menu:

<a name="top"></a>TOP

And at the bottom, in the footer, I put this:

<a href="#top">Back to top</a>

Works perfect in firefox and IE for me.
__________________

TributeK is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 01:11 AM Re: Return to top HTML code
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
You may want to give a link to your site. Perhaps there's a validation issue that's causing your HTML to misinterpret things.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-13-2008, 04:24 AM Re: Return to top HTML code
The Lion's Avatar
Novice Talker

Posts: 12
Name: David
Not a problem. All you need to do is ID any section of text at the top of the page (ex: <p id="linkid">). Then adjust your <a href> line to read more like this: <a href="http://www.yoursite.com/yourpage#linkid.html">.

I'm sure there's some JavaScript that can do the same thing, but this is the way I did it on one site. And it should work no matter what browser you use...

Good luck,
The Lion.

Last edited by The Lion : 01-13-2008 at 04:26 AM.
The Lion is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 11:43 AM Re: Return to top HTML code
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
Quote:
Originally Posted by The Lion View Post
Not a problem. All you need to do is ID any section of text at the top of the page (ex: <p id="linkid">). Then adjust your <a href> line to read more like this: <a href="http://www.yoursite.com/yourpage#linkid.html">.

I'm sure there's some JavaScript that can do the same thing, but this is the way I did it on one site. And it should work no matter what browser you use...

Good luck,
The Lion.

This is just plain wrong. # in a URL takes you to an anchor or the top of the page if the anchor doesn't exist. JavaScript isn't necessary and would be a silly amount of wasted work given that anchors exist. When linking to an anchor, you don't put the #anchor_name before the file extension. Just delete that post from your head.

It's actually not very hard to do what you want:

HTML Code:
<html>
  <head>
    <title>Example</title>
  </head>
  <body>
  <a name="page_top"></a>
  <div style="background-color:#ff0000;height:2000px;"></div>
  <a href="#page_top">Back To Top</a>
  </body>
</html>
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-13-2008, 12:07 PM Re: Return to top HTML code
Novice Talker

Posts: 10
Initially I didn't want to list my URL because I was afraid of getting in trouble with the administrator of the forum but, thanks "JeremyMiller" I have fixed it looking at your code.

It works perfectly.


Thanks a bunch!!!!!!!!!!
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 12:20 PM Re: Return to top HTML code
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
Glad you got it. Listing your URL for a help question won't get you banned. It's when you post your link for the sole purpose of having a link. Sometimes, without the code it's impossible to help. This, fortunately, was easy enough.

Don't forget, you can put links in your signature, but read the rules first as they are a couple of restrictions.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-13-2008, 12:30 PM Re: Return to top HTML code
Novice Talker

Posts: 10
Got it
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 01:19 PM Re: Return to top HTML code
LadynRed's Avatar
Super Moderator

Posts: 6,535
Location: Tennessee
Quote:
This is just plain wrong. # in a URL takes you to an anchor or the top of the page if the anchor doesn't exist.
No, it is not wrong. Using the ID method DOES work properly in ALL browsers and it is preferable to using the old <a name=..."> method. Javascript is not necessary either. Using ID's is cleaner and more semantically correct, and it reduces extra unnecessary code too.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 01:54 PM Re: Return to top HTML code
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 984
Name: Jeremy Miller
Location: Reno, NV
I stand corrected! Thanks Lady. When I first tested, I tested it to work at only the top. This code, however, demonstrates the accuracy of your statement:

HTML Code:
<html>
  <head>
    <title>Example</title>
  </head>
  <body>
  <div style="background-color:#ff0000;height:2000px;"></div>
  <p id="page_top">Here's where to go.</p>
  <div style="background-color:#0000ff;height:2000px;"></div>
  <a href="#page_top">Back To Top</a>
  </body>
</html>
Do you know when that was made so? I've never until now seen this!

I love every day where I learn something absolutely new to me!
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-13-2008, 06:37 PM Re: Return to top HTML code
Novice Talker

Posts: 9
yeah, Every day is a new day. Although, I code a lot I saw this today. Perhaps, I did'nt take out time to upgrade my knowledge. The ID tag looks simple and effective to me too. Will use it next time I need it. Thanks lady for this update

Quote:
Originally Posted by JeremyMiller View Post
I stand corrected! Thanks Lady. When I first tested, I tested it to work at only the top. This code, however, demonstrates the accuracy of your statement:

HTML Code:
<html>
  <head>
    <title>Example</title>
  </head>
  <body>
  <div style="background-color:#ff0000;height:2000px;"></div>
  <p id="page_top">Here's where to go.</p>
  <div style="background-color:#0000ff;height:2000px;"></div>
  <a href="#page_top">Back To Top</a>
  </body>
</html>
Do you know when that was made so? I've never until now seen this!

I love every day where I learn something absolutely new to me!
cool_b is offline
Reply With Quote
View Public Profile
 
Old 01-13-2008, 07:48 PM Re: Return to top HTML code
LadynRed's Avatar
Super Moderator

Posts: 6,535
Location: Tennessee
You're welcome
I can't tell you when it came into being.. so to speak.. but I've been using IDs for anchors for quite some time now. Since it rarely clashes with IDs in my css, it works like a charm.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 01-15-2008, 12:26 PM Re: Return to top HTML code
Novice Talker

Posts: 7
It's just <a href="#">top</a>.
idezmax is offline
Reply With Quote
View Public Profile Visit idezmax's homepage!
 
Old 02-26-2008, 12:06 PM Re: Return to top HTML code
Novice Talker

Posts: 10
Thanks you to you all.

It was fixed.



Maybe I should close this thread....if I can find the way...
__________________
Create your own small business website online for free. Non-profit, non-commercial, always free.
jeron30 is offline
Reply With Quote
View Public Profile
 
Old 02-26-2008, 02:29 PM Re: Return to top HTML code
LadynRed's Avatar
Super Moderator

Posts: 6,535
Location: Tennessee
Quote:
<a href="#" name="top" id="top"></a>
Completely unnecessary. The ID is all that is needed and it can be added to ANY element without the need for the extraneous link code.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile