Display same-page linked item on top - How to?
Display same-page linked item on top - How to?
am 14.08.2007 14:15:34 von Richard
Hi All,
I've got a simple page at http://home.comcast.net/~CaptQueeg/_Mian.html.
It's got an Aptana section at the bottom which is the target of a link
near the top of the page.
When the Aptana link is clicked, I'd like the page to display the
Aptana section at the very top. How can I do that with simple HTML?
Thanks in Advance,
Richard
Re: Display same-page linked item on top - How to?
am 14.08.2007 14:36:04 von mbstevens
Richard wrote:
> Hi All,
>
> I've got a simple page at http://home.comcast.net/~CaptQueeg/_Mian.html.
> It's got an Aptana section at the bottom which is the target of a link
> near the top of the page.
>
> When the Aptana link is clicked, I'd like the page to display the
> Aptana section at the very top. How can I do that with simple HTML?
>
> Thanks in Advance,
> Richard
>
You could write a second page with the 'Aptana' information in any position
you want it to be in. I don't think the load time would be a problem for
pages like you're using.
Re: Display same-page linked item on top - How to?
am 14.08.2007 15:07:12 von a.nony.mous
Richard wrote:
> I've got a simple page at http://home.comcast.net/~CaptQueeg/_Mian.html.
> It's got an Aptana section at the bottom which is the target of a link
> near the top of the page.
...which doesn't work as written. You may have better luck if you use:
> When the Aptana link is clicked, I'd like the page to display the
> Aptana section at the very top. How can I do that with simple HTML?
Simple? Since the Aptana is at the bottom, the page will jump to the
anchor "name" when the link is clicked. If there was more content below
it, it may end up at the top of a browser window.
If you are implying you want it to be *first* at the top of a page, you
will either need to write some scripting to rearrange the whole page, or
as suggested, another page with only that content.
What is the reason you want to do this?
--
-bts
-Motorcycles defy gravity; cars just suck
Re: Display same-page linked item on top - How to?
am 14.08.2007 15:19:54 von Richard
On Aug 14, 8:15 am, Richard
wrote:
> Hi All,
>
> I've got a simple page athttp://home.comcast.net/~CaptQueeg/_Mian.html.
> It's got an Aptana section at the bottom which is the target of a link
> near the top of the page.
>
> When the Aptana link is clicked, I'd like the page to display the
> Aptana section at the very top. How can I do that with simple HTML?
>
> Thanks in Advance,
> Richard
Hi,
I discovered some of the problem: The W3C Markup Validator flagged
two errors, both caused by my code conflicting with the DTD I
specified. The Validator said:
Line 14, Column 11: there is no attribute "NAME".
_Dummy1
You have used the attribute named above in your document, but the
document type you are using does not support that attribute for this
element. This error is often caused by incorrect use of the "Strict"
document type with a document that uses frames (e.g. you must use the
"Transitional" document type to get the "target" attribute)
The DTD I had used was:
"http://www.w3.org/TR/html4/strict.dtd">
I found the Transitional DTD at http://www.w3.org/TR/html401/loose.dtd,
which I am now using:
"http://www.w3.org/TR/html4/loose.dtd">
The validator still gives me:
Line 14, Column 11: there is no attribute "NAME".
But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
where it claims:
You should notice that a named anchor is not displayed in a special
way.
To link directly to the "tips" section, add a # sign and the name of
the anchor to the end of a URL, like this:
Jump to the
Useful Tips Section
[snip]
Is this W3Schools stuff outdated? Any other suggestions?
Thanks in Advance,
Richard
Re: Display same-page linked item on top - How to?
am 14.08.2007 15:39:30 von lws4art
Richard wrote:
>
> I discovered some of the problem: The W3C Markup Validator flagged
> two errors, both caused by my code conflicting with the DTD I
> specified. The Validator said:
>
>
> Line 14, Column 11: there is no attribute "NAME".
>
> _Dummy1
That is correct you want the parameter ID not NAME
_Dummy1
then a link would work...
>
> You have used the attribute named above in your document, but the
> document type you are using does not support that attribute for this
> element. This error is often caused by incorrect use of the "Strict"
> document type with a document that uses frames (e.g. you must use the
> "Transitional" document type to get the "target" attribute)
>
>
> The DTD I had used was:
>
> "http://www.w3.org/TR/html4/strict.dtd">
>
>
> I found the Transitional DTD at http://www.w3.org/TR/html401/loose.dtd,
> which I am now using:
>
> "http://www.w3.org/TR/html4/loose.dtd">
>
Bad idea, this is an new page you should fix the error, not *down-grade*
the doctype.
> The validator still gives me:
>
> Line 14, Column 11: there is no attribute "NAME".
>
>
> But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
> where it claims:
>
>
>
> You should notice that a named anchor is not displayed in a special
> way.
>
> To link directly to the "tips" section, add a # sign and the name of
> the anchor to the end of a URL, like this:
>
> Jump to the
> Useful Tips Section
> [snip]
>
>
>
> Is this W3Schools stuff outdated? Any other suggestions?
>
W3Schools site is notoriously full of incorrect information. Too bad
many are fooled into think that have some affiliation or legitimacy
because of the "W3" in their domain name. I have found www.htmldog.com
information bay far more accurate.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Re: Display same-page linked item on top - How to?
am 14.08.2007 15:45:32 von a.nony.mous
Richard wrote:
> I discovered some of the problem: The W3C Markup Validator flagged
> two errors, both caused by my code conflicting with the DTD I
> specified. The Validator said:
>
>
> Line 14, Column 11: there is no attribute "NAME".
>
> _Dummy1
...which is correct.
> The DTD I had used was:
>
> "http://www.w3.org/TR/html4/strict.dtd">
...which you should use for new pages...
> I found the Transitional DTD at http://www.w3.org/TR/html401/loose.dtd,
> which I am now using:
>
> "http://www.w3.org/TR/html4/loose.dtd">
...and shouldn't, as you are not Transitioning from an old legacy page.
> The validator still gives me:
>
> Line 14, Column 11: there is no attribute "NAME".
>
...which is correct, because there still is no attribute "name" for
> But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
> where it claims:
>
>
Note that the name attribute is used on an anchor, not a heading.
> To link directly to the "tips" section, add a # sign and the name of
> the anchor to the end of a URL, like this:
>
> Jump to the
> Useful Tips Section
> [snip]
>
>
>
> Is this W3Schools stuff outdated?
While some parts of W3Schools are misleading and erroneous, they seem to
be correct in this instance.
> Any other suggestions?
See my other post.
--
-bts
-Motorcycles defy gravity; cars just suck
Re: Display same-page linked item on top - How to?
am 14.08.2007 16:29:57 von Richard
Hi Jonathan,
> That is correct you want the parameter ID not NAME
>
>
_Dummy1
>
> then a link would work...
Thanks, Jonathan. I "knew" I had done this before, but I couldn't
remember how. And it was so long ago, I don't know if I even have
that old code anywhere.
> > The DTD I had used was:
> >
> > "http://www.w3.org/TR/html4/strict.dtd">
>
> > I found the Transitional DTD athttp://www.w3.org/TR/html401/loose.dtd,
> > which I am now using:
> >
> > "http://www.w3.org/TR/html4/loose.dtd">
>
> Bad idea, this is an new page you should fix the error, not *down-grade*
> the doctype.
Point taken.
> > But I got this "name" attribute fromhttp://www.w3schools.com/html/html_links.asp,
[snip]
> > Is this W3Schools stuff outdated? Any other suggestions?
>
> W3Schools site is notoriously full of incorrect information. Too bad
> many are fooled into think that have some affiliation or legitimacy
> because of the "W3" in their domain name. I have found www.htmldog.com
> information bay far more accurate.
Wow! That's incredible. Is there any point if trying to inform the
W3Schools' webmaster about errors as a service to the community?
Finally, I also found a kludge for my other wish: I want to force
every select section to be "scrolled" to the top automatically. This
doesn't happen for small sections near the bottom or if the view
window is made smaller. Is there a better way. I seem to remember
some "_top" attribute.
See it all at http://home.comcast.net/~CaptQueeg/_Mian.html :-)
Best wishes,
Richard
Re: Display same-page linked item on top - How to?
am 14.08.2007 16:37:18 von Richard
On Aug 14, 9:45 am, "Beauregard T. Shagnasty"
wrote:
> Richard wrote:
> > I discovered some of the problem: The W3C Markup Validator flagged
> > two errors, both caused by my code conflicting with the DTD I
> > specified. The Validator said:
>
> >
> > Line 14, Column 11: there is no attribute "NAME".
>
> > _Dummy1
>
> ..which is correct.
>
> > The DTD I had used was:
> >
> > "http://www.w3.org/TR/html4/strict.dtd">
>
> ..which you should use for new pages...
>
> > I found the Transitional DTD athttp://www.w3.org/TR/html401/loose.dtd,
> > which I am now using:
> >
> > "http://www.w3.org/TR/html4/loose.dtd">
>
> ..and shouldn't, as you are not Transitioning from an old legacy page.
>
> > The validator still gives me:
> >
> > Line 14, Column 11: there is no attribute "NAME".
> >
>
> ..which is correct, because there still is no attribute "name" for
>
> > But I got this "name" attribute fromhttp://www.w3schools.com/html/html_links.asp,
> > where it claims:
> >
> >
>
> Note that the name attribute is used on an anchor, not a heading.
>
> > To link directly to the "tips" section, add a # sign and the name of
> > the anchor to the end of a URL, like this:
> >
> > Jump to the
> > Useful Tips Section
> > [snip]
> >
> >
>
> > Is this W3Schools stuff outdated?
>
> While some parts of W3Schools are misleading and erroneous, they seem to
> be correct in this instance.
>
> > Any other suggestions?
>
> See my other post.
>
> --
> -bts
> -Motorcycles defy gravity; cars just suck
Hi Beauregard,
I posted a reply to your first response, buy it appears to have
gotten lost in the aether, notwithstanding Michelson and Morley's
apparent proof that there is no "ether" :-)
No matter. That's been overtaken by events, i.e. please see my
response to Jonathan and take a peek at my latest version at
http://home.comcast.net/~CaptQueeg/_Mian.html.
As usual, thanks again for aiding me in my HTML-CSS education.
Best wishes,
Richard
Re: Display same-page linked item on top - How to?
am 14.08.2007 17:18:06 von a.nony.mous
Richard wrote:
> No matter. That's been overtaken by events, i.e. please see my
> response to Jonathan and take a peek at my latest version at
> http://home.comcast.net/~CaptQueeg/_Mian.html.
Ok, that'll work.
You wouldn't want to use that "dummy section" on a production page,
though. There isn't any good way to do what you want, other than to make
sure you have enough content to keep the anchor/id at the top of the
viewport. And testing it at various browser widths, too, including very
wide ones.
I've never noticed user problems if the anchor spot wasn't right at the
top. They seem to find it...
--
-bts
-Motorcycles defy gravity; cars just suck
Re: Display same-page linked item on top - How to?
am 14.08.2007 17:53:36 von Richard
On Aug 14, 11:18 am, "Beauregard T. Shagnasty"
wrote:
> Richard wrote:
> > No matter. That's been overtaken by events, i.e. please see my
> > response to Jonathan and take a peek at my latest version at
> >http://home.comcast.net/~CaptQueeg/_Mian.html.
>
Hi Beauregard,
> Ok, that'll work.
Yeah, thankfully. I love that technique. Presently I save my notes
as .doc files in a hierarchy of subject directories. There's lots
wrong with that, but I wasn't willing to spend time/energy/money on
coming up with a better way ... until now, when I'm starting to "feel
my oats" with HTML-CSS-JavaScript in my new software-developer
incarnation.
BTW, my history is Visual C++/MFC/COM on Windows; C on VAX/VMS; DG
and Eclipse with Basic; micros with CP/M and C; IBM Mainframes with
PL/1, Cobol, Fortran, ASM; IBM 1620 with Fortran, Assembler.
There's still going to be annoying bookkeeping to synchronize the
links and the content, but I'm already planning two things:
1. a Ruby script to take a newly modified "Notes.html", backup the
modified file, strip its "menu" of links, regenerate the links based
on text in tags, paste the new links in the new file.
2. Through in some Ruby on Rails and Ajax so that only top-level links
are shown and subordinate links to links are shown for for the
current link and the links are closed when a new link is
selected.
I don't know how it'll all work out, if ever, but I'll have fun.
> You wouldn't want to use that "dummy section" on a production page,
> though. There isn't any good way to do what you want, other than to make
> sure you have enough content to keep the anchor/id at the top of the
> viewport. And testing it at various browser widths, too, including very
> wide ones.
Presently, I'm only concerned out my own "Notebook". Nevertheless,
I don't think my hack will be a problem if I publish such a thing. If
I do publish and find a problem, I'll resort to scripting,
> I've never noticed user problems if the anchor spot wasn't right at the
> top. They seem to find it...
I was the counter-example. I clicked on my link (after the code was
corrected, but without my hack) and saw nothing change. I leaped to
the conclusion that there was something wrong with my code. Of course
I eventually realized that browsers don't operate the way they should
IMHO.
Again, my thanks, Beauregard, for "tuning in". I very much
appreciate your insights.
Best wishes,
Richard
Re: Display same-page linked item on top - How to?
am 14.08.2007 17:57:43 von Richard
I meant:
2. Throw in ...
My fingers didn't hear what my brain meant :-)
Re: Display same-page linked item on top - How to?
am 15.08.2007 01:15:09 von Bergamot
Beauregard T. Shagnasty wrote:
>
> You may have better luck if you use:
>
>
Why is that better than ?
The only browser I know of that doesn't support using id as an anchor is
Netscape 4.x. Or is there another similarly broken browser out there?
--
Berg
Re: Display same-page linked item on top - How to?
am 15.08.2007 03:40:26 von cfajohnson
On 2007-08-14, Richard wrote:
> But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
> where it claims:
>
>
>
> You should notice that a named anchor is not displayed in a special
> way.
>
> To link directly to the "tips" section, add a # sign and the name of
> the anchor to the end of a URL, like this:
>
>Jump to the
> Useful Tips Section
> [snip]
>
>
>
> Is this W3Schools stuff outdated? Any other suggestions?
No, but you need to read it more carefully (or maybe they need to
explain it clearly). The "name" attribute can be applied to an
acnchor, but not to a heading.
That usage is not recommended however; it is generally considered
better to use the "id" attribute instead.
--
Chris F.A. Johnson
============================================================ =======
Author:
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Re: Display same-page linked item on top - How to?
am 15.08.2007 04:07:00 von dorayme
In article ,
"Chris F.A. Johnson" wrote:
> On 2007-08-14, Richard wrote:
>
> > But I got this "name" attribute from
> > http://www.w3schools.com/html/html_links.asp,
> > where it claims:
> >
> >
> >
>
> That usage is not recommended however; it is generally considered
> better to use the "id" attribute instead.
One reason it is better is that it is simpler to use/type.
Another is to avoid having to code to avoid hover effects on
"named anchors" which are really not appropriate. These hover
effects and other effects can easily creep in from the css sheet
which generally specifies anchors. You will find id_ing much
cleaner and simpler to use for the purpose.
--
dorayme
Re: Display same-page linked item on top - How to?
am 15.08.2007 07:50:21 von Richard
On Aug 14, 9:40 pm, "Chris F.A. Johnson" wrote:
> On 2007-08-14, Richard wrote:
> > But I got this "name" attribute fromhttp://www.w3schools.com/html/html_links.asp,
> > where it claims:
> >
> >
>
> > You should notice that a named anchor is not displayed in a special
> > way.
>
> > To link directly to the "tips" section, add a # sign and the name of
> > the anchor to the end of a URL, like this:
> >
> >Jump to the
> > Useful Tips Section
> > [snip]
> >
> >
>
> > Is this W3Schools stuff outdated? Any other suggestions?
>
> No, but you need to read it more carefully (or maybe they need to
> explain it clearly). The "name" attribute can be applied to an
> acnchor, but not to a heading.
>
> That usage is not recommended however; it is generally considered
> better to use the "id" attribute instead.
>
> --
> Chris F.A. Johnson
> ============================================================ =======
> Author:
> Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
Hi Chris,
> > Is this W3Schools stuff outdated? Any other suggestions?
>
> No ...
I'm glad to know that because I've visited the site a lot and
benefited a lot from it.
> ... but you need to read it more carefully (or maybe they need to
> explain it clearly). The "name" attribute can be applied to an
> acnchor, but not to a heading.
I noticed that it was applied to an anchor, but didn't notice
anything suggesting that other tags couldn't use the "name"
attribute. If I hadn't used this referencing approach before (with
"id", apparently, but I couldn't remember the attribute), I might not
have presumed it would apply to other tags. But all's well that ends
well ... that's my motto.
> That usage is not recommended however; it is generally considered
> better to use the "id" attribute instead.
Great!
Best wishes,
Richard
Re: Display same-page linked item on top - How to?
am 15.08.2007 07:52:33 von Richard
On Aug 14, 10:07 pm, dorayme wrote:
> In article ,
> "Chris F.A. Johnson" wrote:
>
> > On 2007-08-14, Richard wrote:
>
> > > But I got this "name" attribute from
> > >http://www.w3schools.com/html/html_links.asp,
> > > where it claims:
> > >
> > >
>
> > That usage is not recommended however; it is generally considered
> > better to use the "id" attribute instead.
>
> One reason it is better is that it is simpler to use/type.
> Another is to avoid having to code to avoid hover effects on
> "named anchors" which are really not appropriate. These hover
> effects and other effects can easily creep in from the css sheet
> which generally specifies anchors. You will find id_ing much
> cleaner and simpler to use for the purpose.
>
> --
> dorayme
Hi dorayme,
Interesting -- nice to know.
Best wishes,
Richard
Re: Display same-page linked item on top - How to?
am 15.08.2007 08:59:06 von jkorpela
Scripsit Bergamot:
> Beauregard T. Shagnasty wrote:
>>
>> You may have better luck if you use:
>>
>>
>
> Why is that better than ?
>
> The only browser I know of that doesn't support using id as an anchor
> is Netscape 4.x. Or is there another similarly broken browser out
> there?
Perhaps there is. Other reasons that might make people use the old construct
include:
1) They have some utility that assumes such anchors. (I do. I'm ashamed but
I won't touch my Perl code - Perl is, after all, a write-only language -
just to fix that.) Generally not relevant at all, but if relevant, it can be
very relevant.
2) They use authoring software that creates such links. There's usually no
reason to hand-edit them. I suppose there is such software.
3) They want to use an anchor name that does not conform to ID syntax. Beats
me why, but such anchors _are_ used.
4) They intend to style the heading in a manner that requires its content to
be wrapped in an inline container (a fairly common trick). Rather than using
, why not use ?
So no good reason really, as a rule.
--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/
Re: Display same-page linked item on top - How to?
am 15.08.2007 13:31:57 von a.nony.mous
Bergamot wrote:
> Beauregard T. Shagnasty wrote:
>>
>> You may have better luck if you use:
>>
>>
>
> Why is that better than ?
It's not. I used a sample using "
following solution, and I correctly put it in the :
But I got this "name" attribute from
http://www.w3schools.com/html/html_links.asp,
where it claims:
--
-bts
-Motorcycles defy gravity; cars just suck
Re: Display same-page linked item on top - How to?
am 16.08.2007 03:26:04 von Bergamot
Jukka K. Korpela wrote:
>
> Other reasons that might make people use the old construct
> include:
>
> 1) They have some utility that assumes such anchors. (I do. I'm ashamed but
> I won't touch my Perl code
Tsk tsk. Sounds like a personal problem to me. ;)
--
Berg