Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Display same-page linked item on top - How to?

Reply
Thread Tools

Display same-page linked item on top - How to?

 
 
Richard
Guest
Posts: n/a
 
      08-14-2007
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

 
Reply With Quote
 
 
 
 
mbstevens
Guest
Posts: n/a
 
      08-14-2007
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.
 
Reply With Quote
 
 
 
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      08-14-2007
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:

<h2><a name="Aptana">Aptana</a></h2>

> 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
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      08-14-2007
On Aug 14, 8:15 am, Richard
<(E-Mail Removed)> 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:

<quote>
Line 14, Column 11: there is no attribute "NAME".

<h2 name="_Dummy1">_Dummy1</h2>

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)
</quote>

The DTD I had used was:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"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:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

The validator still gives me:
<quote>
Line 14, Column 11: there is no attribute "NAME".
</quote>

But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
where it claims:
<quote>
<a name="tips">Useful Tips Section</a>

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:
<quote>
<a href="http://www.w3schools.com/html_links.asp#tips">Jump to the
Useful Tips Section</a>
[snip]
<a href="#tips">Jump to the Useful Tips Section</a>
</quote>

Is this W3Schools stuff outdated? Any other suggestions?

Thanks in Advance,
Richard


 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      08-14-2007
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:
>
> <quote>
> Line 14, Column 11: there is no attribute "NAME".
>
> <h2 name="_Dummy1">_Dummy1</h2>


That is correct you want the parameter ID not NAME

<h2 id="_Dummy1">_Dummy1</h2>


then a link <a href="#_Dummy1">To _Dummy1</a> 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)
> </quote>
>
> The DTD I had used was:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "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:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "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:
> <quote>
> Line 14, Column 11: there is no attribute "NAME".
> </quote>
>
> But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
> where it claims:
> <quote>
> <a name="tips">Useful Tips Section</a>
>
> 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:
> <quote>
> <a href="http://www.w3schools.com/html_links.asp#tips">Jump to the
> Useful Tips Section</a>
> [snip]
> <a href="#tips">Jump to the Useful Tips Section</a>
> </quote>
>
> 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
 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      08-14-2007
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:
>
> <quote>
> Line 14, Column 11: there is no attribute "NAME".
>
> <h2 name="_Dummy1">_Dummy1</h2>


...which is correct.

> The DTD I had used was:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "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:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "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:
> <quote>
> Line 14, Column 11: there is no attribute "NAME".
> </quote>


...which is correct, because there still is no attribute "name" for <h2>

> But I got this "name" attribute from http://www.w3schools.com/html/html_links.asp,
> where it claims:
> <quote>
> <a name="tips">Useful Tips Section</a>


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:
> <quote>
> <a href="http://www.w3schools.com/html_links.asp#tips">Jump to the
> Useful Tips Section</a>
> [snip]
> <a href="#tips">Jump to the Useful Tips Section</a>
> </quote>
>
> 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
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      08-14-2007
Hi Jonathan,

> That is correct you want the parameter ID not NAME
>
> <h2 id="_Dummy1">_Dummy1</h2>
>
> then a link <a href="#_Dummy1">To _Dummy1</a> 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:
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > "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:
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "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

 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      08-14-2007
On Aug 14, 9:45 am, "Beauregard T. Shagnasty"
<(E-Mail Removed)> 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:

>
> > <quote>
> > Line 14, Column 11: there is no attribute "NAME".

>
> > <h2 name="_Dummy1">_Dummy1</h2>

>
> ..which is correct.
>
> > The DTD I had used was:
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> > "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:
> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> > "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:
> > <quote>
> > Line 14, Column 11: there is no attribute "NAME".
> > </quote>

>
> ..which is correct, because there still is no attribute "name" for <h2>
>
> > But I got this "name" attribute fromhttp://www.w3schools.com/html/html_links.asp,
> > where it claims:
> > <quote>
> > <a name="tips">Useful Tips Section</a>

>
> 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:
> > <quote>
> > <a href="http://www.w3schools.com/html_links.asp#tips">Jump to the
> > Useful Tips Section</a>
> > [snip]
> > <a href="#tips">Jump to the Useful Tips Section</a>
> > </quote>

>
> > 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

 
Reply With Quote
 
Beauregard T. Shagnasty
Guest
Posts: n/a
 
      08-14-2007
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. <g>

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
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      08-14-2007
On Aug 14, 11:18 am, "Beauregard T. Shagnasty"
<(E-Mail Removed)> 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. <g>


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 <h2> 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 <h3> links are shown for for the
current link and the <h3> links are closed when a new <h2> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
display the selected item at the top in a gridview Robert Smith ASP .Net 1 03-09-2008 02:46 PM
ASP.Net 2.0 Insert new item, then display this new item in Edit mo Ann ASP .Net Web Controls 0 03-28-2007 01:11 AM
Display Related Item or Add Item ssoss ASP .Net 2 09-18-2003 11:35 PM
Generating a char* from a linked list of linked lists Chris Ritchey C++ 7 07-10-2003 10:12 PM



Advertisments