[thelist] [SPAM] Re: [SPAM] Re: ajax tabscontent

Christian Heilmann codepo8 at gmail.com
Mon Jul 10 13:48:21 CDT 2006


> > Why not just compare the current location with the HREF? That's what I
> > am doing in DOMtab.
>
> While that is one approach, I think the reason is to have the tabs not related to the URL. e.g. on the code demo page, the URL is irrelavent to the tabs being activated. The question was to activate a tab via the URL. Who knows where that URL is coming from, the only thing we can make sure is consistent is a Query String key:value.

No, you can also use an anchor name for consistency. Tabs that are in
reality a navigation should simply reload the whole page and get the
content in. Then you can hijack this link, do some Ajax magic and only
reload the tab. If you fiddle around with IDs you make the navigation
dependent on JavaScript, and that is just not safe.

> > Using IDs and classes for data storage is as dirty as using FONT tags.
> > When will people learn that you cannot assume markup as CMS and other
> > systems will mess around with it?
>
> dotNet uses the ID tag for creating objects out of the elements. IDs need to be unique on a page, so they are inherently useful IMvHO.

And .NET generates these IDs (invalid ones at times - and there is no
such thing as an ID tag, it is an attribute), so there is no
maintenance issue.
However, if you expect the maintainer to create IDs for each and every
link in a navigation then you negate the whole idea of inheritance in
CSS for the sake of making a script work. You also make sure that
maintaining the script means having to change the HTML and the CSS
probably. This is not innovation, we did the same with javascript: or
onclick=showmenu(3) DHTML navigations.

> Are you saying that the GetElementById function should be avoided? And you should only be drilling down through your code via GetElementsByName or some such DOM walking? Seems to me that IDs are extremely useful (albeit can be over used) - but I'm willing to be enlightened as to otherwise.

I never claimed that. IDs should be used to allow for easy access to
main parts of the document, and that is for one the site menu. Using
an ID on each and every element of the navigation is overkill and a
nightmare to make maintainable via a CMS for example (unless you
create IDs on the fly or via the backend).

All I want is clean navigations and easy to read URLs - so do search
engines and people who bookmark your site. There are ways to allow for
that and to have the cool Ajax effects, the whole trick is to start
from the premise that they are not available and not from the other
side.

-- 
Chris Heilmann
Book: http://www.beginningjavascript.com
Blog: http://www.wait-till-i.com
Writing: http://icant.co.uk/



More information about the thelist mailing list