|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
 |
|
|
01-12-2008, 10:50 PM
|
Return to top HTML code
|
Posts: 11
|
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
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
01-12-2008, 11:32 PM
|
Re: Return to top HTML code
|
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.
|
|
|
|
01-12-2008, 11:49 PM
|
Re: Return to top HTML code
|
Posts: 11
|
Nope, it didn't work... 
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
01-12-2008, 11:54 PM
|
Re: Return to top HTML code
|
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?
|
|
|
|
01-13-2008, 12:20 AM
|
Re: Return to top HTML code
|
Posts: 11
|
Yes I did. The thing is that EVERYTHING works just fine in IE but not in firefox.
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
01-13-2008, 12:32 AM
|
Re: Return to top HTML code
|
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.
|
|
|
|
01-13-2008, 01:11 AM
|
Re: Return to top HTML code
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, 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
Please login or register to view this content. Registration is FREE
|
|
|
|
01-13-2008, 04:24 AM
|
Re: Return to top HTML code
|
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..
|
|
|
|
01-13-2008, 11:43 AM
|
Re: Return to top HTML code
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
|
Quote:
Originally Posted by The Lion
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
Please login or register to view this content. Registration is FREE
|
|
|
|
01-13-2008, 12:07 PM
|
Re: Return to top HTML code
|
Posts: 11
|
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!!!!!!!!!!
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
01-13-2008, 12:20 PM
|
Re: Return to top HTML code
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, 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
Please login or register to view this content. Registration is FREE
|
|
|
|
01-13-2008, 12:30 PM
|
Re: Return to top HTML code
|
Posts: 11
|
Got it 
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
01-13-2008, 01:19 PM
|
Re: Return to top HTML code
|
Posts: 10,017
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 !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
01-13-2008, 01:54 PM
|
Re: Return to top HTML code
|
Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, 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
Please login or register to view this content. Registration is FREE
|
|
|
|
01-13-2008, 06:37 PM
|
Re: Return to top HTML code
|
Posts: 8
|
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
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!
|
|
|
|
|
01-13-2008, 07:48 PM
|
Re: Return to top HTML code
|
Posts: 10,017
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 !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
01-15-2008, 12:26 PM
|
Re: Return to top HTML code
|
Posts: 9
|
It's just <a href="#">top</a>.
|
|
|
|
02-26-2008, 12:06 PM
|
Re: Return to top HTML code
|
Posts: 11
|
Thanks you to you all.
It was fixed.
Maybe I should close this thread....if I can find the way... 
__________________
Please login or register to view this content. Registration is FREE Non-profit, non-commercial, always free.
|
|
|
|
02-26-2008, 02:29 PM
|
Re: Return to top HTML code
|
Posts: 10,017
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 !!
Please login or register to view this content. Registration is FREE
Please login or register to view this content. Registration is FREE
|
|
|
|
02-28-2008, 03:29 PM
|
Re: Return to top HTML code
|
Posts: 143
Name: Blake
Location: Cuyahoga falls,Ohio
|
Ok,ahah i had the same question About Anchor Links and i had to stop and think!!! what i was doing wrong If youre using divs for the Main Layout of youre Page wherever you want that Link to Bring you back to the top to go all u do is Put a Link <a href="#lets say Layer2">And this Link takes you to Layer to  </a>
Its seemed hard at first But then U look at it and its just one of those things that fly over youre Head when youre Really Concentrating
|
|
|
|
|
« Reply to Return to top HTML code
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|