473,320 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

tree menu in dhtml

I've been trying to add a tree menu to my website with some luck (more
or less). I came across a script on simplythebest.net, but I seem to
be having a problem with it... and since they have no help section,
this has brought me here.

The script can be found at
http://simplythebest.net/scripts/DHT...cript_100.html
(no login or anything required... I just thought the script might be
too long to repost here)

The problem:

It says to change the number 22 in the line
function makeDatabase() {
outline = new makeArray(22)
to the number of outlines plus one. Well, It turns out I'm going to
need around 40 or so outlines, but when I change the number to 40 or
41 (however many I added plus one) it only shows the first 20 or so
outlines on my page and just cuts off the rest. I'm still learning
dhtml and javascript, so I don't know what else I can change to have
it show the other 20something links.

Any thoughts would be most helpful.

Thanks!
Jul 23 '05 #1
18 3505
On 15 Sep 2004 00:12:35 -0700, Andromeda <tu*****@hotmail.com> declared
in comp.infosystems.www.authoring.html:
http://simplythebest.net/scripts/DHT...cript_100.html Any thoughts would be most helpful.


Without Javascript, not only does the menu not work, it doesn't even
exist.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 23 '05 #2
Mark Parnell <we*******@clarkecomputers.com.au> wrote in message news:<13******************************@40tude.net> ...
On 15 Sep 2004 00:12:35 -0700, Andromeda <tu*****@hotmail.com> declared
in comp.infosystems.www.authoring.html:
http://simplythebest.net/scripts/DHT...cript_100.html

Any thoughts would be most helpful.


Without Javascript, not only does the menu not work, it doesn't even
exist.

Should I assume this means you have scripts disabled on your machine?
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.
Jul 23 '05 #3
On 15 Sep 2004 08:52:05 -0700, Andromeda <tu*****@hotmail.com> wrote:
Mark Parnell <we*******@clarkecomputers.com.au> wrote in message
news:<13******************************@40tude.net> ...
On 15 Sep 2004 00:12:35 -0700, Andromeda <tu*****@hotmail.com> declared
in comp.infosystems.www.authoring.html:
> http://simplythebest.net/scripts/DHT...cript_100.html

> Any thoughts would be most helpful.


Without Javascript, not only does the menu not work, it doesn't even
exist.

Should I assume this means you have scripts disabled on your machine?
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.


Client side scripting must be assumed off in design. Test with it off.

Whether or not the browsers you've used show the site to function, the
recommendations allow UAs to ignore scripts. So your design must account
for that reality.

If you MUST use client-side scripting to make links, provide a real link
alternative so content can be accessed.
Jul 23 '05 #4
On Wed, 15 Sep 2004, Andromeda wrote:
Should I assume this means you have scripts disabled on your machine?
Doesn't everyone, when visiting untrusted web pages? :-}
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.


You're new around here, evidently.
Jul 23 '05 #5
On 15 Sep 2004 08:52:05 -0700, tu*****@hotmail.com (Andromeda) wrote:
Mark Parnell <we*******@clarkecomputers.com.au> wrote in message news:<13******************************@40tude.net> ...
On 15 Sep 2004 00:12:35 -0700, Andromeda <tu*****@hotmail.com> declared
in comp.infosystems.www.authoring.html:
> http://simplythebest.net/scripts/DHT...cript_100.html
> Any thoughts would be most helpful.


Without Javascript, not only does the menu not work, it doesn't even
exist.

Should I assume this means you have scripts disabled on your machine?
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.


I've tried to explain it a bit in:
http://www.xs4all.nl/~sbpoley/webmatters/whatnojs.html

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Jul 23 '05 #6
Stephen Poley skrev 2004-09-15 19:31:
On 15 Sep 2004 08:52:05 -0700, tu*****@hotmail.com (Andromeda) wrote:
Should I assume this means you have scripts disabled on your machine?
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.


I've tried to explain it a bit in:
http://www.xs4all.nl/~sbpoley/webmatters/whatnojs.html


A you say on your page Stephen, estimates vary how many visitors browse
without Javascript. According to W3Schools
(http://www.w3schools.com/browsers/browsers_stats.asp) 10% did it in
July 2004. But the figures from different sites depends a lot according
to what kind of visitors the site has.

On a large part of popular sites it's not possible to do anything if you
don't have Javascript enabled (shopping, game, entertainment etc). So
those sites probably get almost 100% JS enabled in their stats :-)

I truly belive most IE-users don't disable Javascript. That's because
IE-users is in large majority on sites like those mentioned above. And
it's not easy to changed in IE from disable to enable and back again
within a couple of minutes an do the same thing all over again a few
minutes later. With Mozilla that's easier :-)

But I really recommend everybody not to use Javascript (and DHTML is
mostly JS) on "critical" parts of the site, sutch as the menu. Not only
because some visitors don't have JS enabled, but for som visitors the
script may not work even if they have it on. For not critical things JS
may be used. But an the other hand, is those not critical things useful
at all?

--
/Arne
Jul 23 '05 #7
On Wed, 15 Sep 2004, Arne wrote:
I truly belive most IE-users don't disable Javascript.
So do I; but eventually some of them are going to get tired of having
their systems trashed for them. Maybe they'll find one of the web
sites (including MS themselves) where disabling JS for untrusted sites
is recommended.
it's not easy to changed in IE from disable to enable and back again
within a couple of minutes an do the same thing all over again a few
minutes later.
But that's not the way to do it! Go to tools -> internet options ->
security. Some of the settings are on the Custom dialog...

One way is to define the security options for the Internet Zone -
disabling JS - and for the Trusted Sites zone - where you enable JS.
Then, when you meet a site that you're prepared to trust, and which
needs JS, you put it into the Trusted sites zone. (Much the same for
other kinds of client-side active content).

Another way is to set the JS option to Prompt, so that any site that
wants to use JS causes a popup dialog. Then you get to choose on a
visit by visit basis. Note, by the way, that MS then comes up with a
hopelessly anodyne warning: "Scripts are usually safe". Translation:
"Scripts are sometimes dangerous, and occasionally can trash your
system - are you sure this is worth it?".
With Mozilla that's easier :-)
Indeed.
But I really recommend everybody not to use Javascript (and DHTML is
mostly JS) on "critical" parts of the site, sutch as the menu.
If we're talking about web pages "per se" (and in the present thread I
think we are), the key is not to *rely* on it for critical function.
Use it, if you want to use it, for extra optional conveniences, and
I'll make no objection. But ensure that the web page is functional
without it.

There are exceptions, (typically referred to as "web applications"),
where the web "page" is really a kind of control panel for driving
some complex system. In that case there may well be situations where
JS, Java, and even other kinds of active content can be justified, if
the task can't be sensibly undertaken without them. My example for
this would be vrvs.org. But I consider those to be very much an
exception, compared with the more normal kind of web page. And I
trust those chaps not try causing mischief on my system.
Not only because some visitors don't have JS enabled, but for som
visitors the script may not work even if they have it on.


Right. For example, indexing robots ;-)

Jul 23 '05 #8
Arne wrote:
estimates vary how many visitors browse without Javascript. According
to W3Schools (http://www.w3schools.com/browsers/browsers_stats.asp)
10% did it in July 2004.
www stats are never entirely reliable.
But the figures from different sites depends a lot according to what
kind of visitors the site has.
Indeed. The one thing you can be sure of is that there are at least
*some* non-javascript user-agents that will visit your site. Since that
is a given, it naturally follows that you must design a site such that
javascript is not required, as Neal said.
On a large part of popular sites it's not possible to do anything if
you don't have Javascript enabled (shopping, game, entertainment
etc).
Large popular sites do lots of dumb things. I wouldn't recommend that
anyone copy them.
So those sites probably get almost 100% JS enabled in their stats :-)
Just one of the reasons why www stats are unreliable.
I truly belive most IE-users don't disable Javascript.
You can "truly believe" anything you like. But how will that change
anyone's mind here?
But I really recommend everybody not to use Javascript (and DHTML is
mostly JS) on "critical" parts of the site, sutch as the menu. Not
only because some visitors don't have JS enabled, but for som
visitors the script may not work even if they have it on.
Exactly so.
For not critical things JS may be used. But an the other hand, is
those not critical things useful at all?


Of course. Javascript form validation provides faster error prevention
help than the server side variety. A good form has both: js for a quick
response, server side for those without js. I've seen neat js scripts to
create pull quotes from a text with simple markup. No js? All that's
lost is the pull quotes; the text is unchanged. There are loads of
useful add-ons you can do with js. Check out comp.lang.javascript for
more on this. Just be sure to note who has a clue, and who are the
"cowboys" (to steal Nick Kew's term) creating fragile scripts with no
useful fallback.

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #9
This goes as a reply for both Alan and Brian, and forgive for leaving
out most of the quotes :-)

I totaly agree to what you say, but unfortunaly that don't change
anything about how the large majority of the (IE)users do and not do
when surfing.

You know what is the best way to do things, I know it to (i hope). And
so do a lot of others. Especially they who use other UA's than IE and
who use other OS's than Windows.

But the large majority is using Windows and still do it different. From
my personal experience, I know a great lot of them don't change the
default settings for security or almost everything else, have their OE
for HTML format for mail, don't even do much Windows Updates.

Brian said:
Large popular sites do lots of dumb things. I wouldn't recommend that
anyone copy them.
But still most of them do that. That's the main reason why the majority
don't disable JS. I don't like it, you don't like it, but it's the fact.
You can "truly believe" anything you like. But how will that change
anyone's mind here?
My purpose was not to change anybodys mind here. I guess most of the
posters here can estimate from their experience, and I do it from mine.
From your experience, do you belive most IE-users disable Javascript?
We say they should disable, but that don't change anything since they
(most IE-users) are not even participating in this group.

Alan said: Maybe they'll find one of the web sites (including MS themselves)
where disabling JS for untrusted sites is recommended.
I hope so. I did it long ago, and that was the time I found out that
changing browser and mail client was the best thing to do :-)

But I still see so many asking for help because they are struggling with
virus, adware, trojans etc. etc. But when they get clean, they continue
to use IE/OE in the same way they did earlier. And therefore they are
coming back asking for help, over and over again.
There are exceptions, (typically referred to as "web applications")


Yes, that's true. Now rule without exceptions :-)
But I must have really, really great interest (and trust) in a site that
says I *must* not only enable Java, but also Javascript, Cookies and
Pop-up windows in order to use their service. Java is one thing that I
always keep disabled.

And vrvs.org may be sutch a company, if I would need the kind of service
they provide. But first I would look at other options, if it's possible
to do what I want in a other way. :-)

I hope you understand that I agree with you how it should be. I just
don't belive it's so, and also wonder how it can be like it should :-)

--
/Arne
Jul 23 '05 #10
Brian wrote:
Arne wrote: <snip>
But I really recommend everybody not to use Javascript
(and DHTML is mostly JS) on "critical" parts of the site,
That seems a little extreme, and likely to be interpreted as a knee-jurk
reaction and the guidance possibly dismissed for that reason alone. I
don't see why there should be an inverse relationship between the
critical-ness of a part of a web site and the use of javascript, as
such. In the event of its inevitable failure in some environments a
well-designed browser script will facilitate fall-back (possibly to
server-side alternatives) or cleanly degrade, leaving the underlying
HTML as viable as it would be without the script. In that case it
doesn't matter how critical the page is, it won't be rendered non-viable
by the failure of the script.

The problem is that well-designed scripts are very much in the minority,
and in a world where ineptly authored 'copy-and-paste' scripts are
available in their thousands from scores of web sites, or listed as
examples in scripting books/web tutorials, or churned out by popular web
page authoring software, or posted to Usenet by individuals who haven't
yet seen (and may never see, or recognise) the issues.

Unfortunately, it takes time and effort to learn how to design and
program a decent browser scripts and there are only a relatively small
number of individuals who have made that effort, and (for technical
reasons related to the requirements of good script design) they are not
writing 'copy-and-paste' scripts.

While the apparent simplicity of javascript as a language, the absence
of a need for any special authoring software, followed by superficial
success in writing scripts ("worked fine on every browser/computer I've
tried it on" ( == default configurations of two or three browsers
exclusively on the Windows OS)), leaves many with sufficient confidence
in their scripting abilities that they start lumbering clients (and
other unsuspecting victims) with scripts that do needlessly screw-up
critical parts of web sites.

My formulation of the advice would be that anyone who cannot look at a
javascript source and see; when and where it will fail, why it will
fail, and (most importantly) how it will fail (in the sense of the
consequences of its failure), should not consider themselves qualified
to judge the script, or its suitability for inclusion on a public web
site (and especially any critical part of that site). And; if in doubt
seek qualified advice or leave the script alone.

<snip> For not critical things JS may be used. But an the other hand, is
those not critical things useful at all?


Of course. Javascript form validation provides faster error
prevention help than the server side variety. A good form
has both: js for a quick response, server side for those
without js.


Part of the reason that server-side validation is not optional is that
even with a javascript enabled client what gets sent to the server may
still not have been validated (possibly deliberately), and there is
noting to that says HTTP requests can only originate with web browsers
anyway. The server is the only place where validation is 100% reliable.
I've seen neat js scripts to create pull quotes from a text
with simple markup. No js? All that's lost is the pull quotes;
the text is unchanged. There are loads of useful add-ons you
can do with js. Check out comp.lang.javascript for more on this.
Just be sure to note who has a clue, and who are the "cowboys"
(to steal Nick Kew's term) creating fragile scripts with no
useful fallback.


The tree menu is one of the easier scripts to design for clean
degradation. The fragile scripts define the data for the menu in some
sort of javascript structure, so when they fail there is nothing at all
available to the user. A better strategy defines the data in the HTML,
usually as nested UL elements. That alone means that total failure (as
is inevitable when javascript is not enabled or available) leaves the
user with access to anything contained in the menu (along with search
engines and the like). The script then only has to verify that the
browser supports the features that would be needed, locate the UL
structure, and work through it changing its CSS and adding event
handlers to transform the ULs into the tree menu. If the scripts is
suitably cautions and leaves the HTML alone unless it is certain that
the scripted menu is viable, then you have a menu that will probably
work as well as the fragile script on the same browsers, but without
denying the user access to the basic functionality regardless of which
browser they use (or how they configure it).

Netscape 4 is not amenable to that strategy, and it is a
disproportionate effort to actively support some less dynamic browsers
like Opera <= 6, but as the users of those browsers will still have
access to the underlying HTML they are no worse off than users who don't
have javascript at all and so can still use the page.

There remain issues that such a script still needs to address. Such as
keyboard navigation (required by WCAG 1.0) and how screen-readers
working with javascript enabled browsers will handle the dynamic
manipulation of the content.

Richard.
Jul 23 '05 #11
On 15 Sep 2004 08:52:05 -0700, Andromeda <tu*****@hotmail.com> declared
in comp.infosystems.www.authoring.html:
Should I assume this means you have scripts disabled on your machine?
Not usually, but you should always test under those conditions.
I'm not really sure what I need to do with this response since its
worked fine on every browser/computer I've tried it on.


They all had Javascript enabled, then.

No statistics are ever totally accurate on the web, but most estimates
say between about 10-15% of people surf with scripting disabled. Using
navigation that relies on Javascript to function is therefore
effectively the same as shutting down the server on New Years Day and
not turning it back on until the second week of February.

Plus your site's potentially most important visitor, Googlebot, doesn't
support Javascript, therefore won't be able to follow the links to any
of the other pages on your site.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 23 '05 #12
I appreciate all the articles here, but none of these seem to answer
my original question.

And no, I am not new around here. No, I am not new to web authoring.
Yes, the site is functional without the menu. The site you are viewing
is not my site, it's only the place I found the script.
Jul 23 '05 #13
begin quote from Andromeda in
<c3**************************@posting.google.com >:
I've been trying to add a tree menu to my website with some luck (more
or less). I came across a script on simplythebest.net, but I seem to
be having a problem with it... and since they have no help section,
this has brought me here.


This has nothing to do with HTML. "DHTML" actually refers to Javascript
(most of the time) or certain elements of CSS (most of the rest). So, maybe
ask in one of those groups, or the script author.

--
Shawn K. Quinn
Jul 23 '05 #14
On Wed, 15 Sep 2004 18:40:22 GMT, Arne <ar**@luras.nu> wrote:
I truly belive most IE-users don't disable Javascript.


True.

But are you still going to dump on the others ?
It's not about doing something for _most_ users, it's about thinking
how it works for _all_ users. It's OK to be restricted for some users
with the feature turned off, but you have to give them something.
How I do this is with a mix of CSS and maybe JS, but JS doesn't really
add much anyway.

Build a nested menu structure of <menu> or <ul>. On each <li> that
represents the current position, set the attribute class="current".
Apart from the attribute, the entire menu structure can be duplicated
between pages, which makes content management easier ( I cut and
paste, then have a small Perl script that does the fixup for the
atribute)

In CSS, set top level <li> to be visible and child level <li><li> to
be hidden. Set the child level <li>s where they're "current" to be
visible.

More CSS to colour highlight the current meu path

Use a:hover or some JS rollovers to make child <li> pop-up when
they're rolled over and maybe hide the current path temporarily.

If you have all the bells and whistles, this is a dynamic menu,
whether you do it with CSS or JS.

If JS is turned off or the a:hover selectors don;t work, you can't nav
to "cousin" menu selections, but you can get there through the top
level and the "uncle" selection.

If CSS is entirely broken, the whole menu structure becomes visible.
This is probably ugly, but it still works.

--
Smert' spamionam
Jul 23 '05 #15
Andy Dingley skrev 2004-09-16 12:55:
On Wed, 15 Sep 2004 18:40:22 GMT, Arne <ar**@luras.nu> wrote:
I truly belive most IE-users don't disable Javascript.
True.

But are you still going to dump on the others ?


No, I'm not. Did I give you that impression?
I just said what I belive is the fact among the "avarge" users, from my
personal experience. I don't said that I would use JS and "dump on the
others". I'm on the contrary, are saying: Don't use JS at all if you can
find alternatives to what you like to do, alternatives that work for
everybody.
It's not about doing something for _most_ users, it's about thinking
how it works for _all_ users. It's OK to be restricted for some users
with the feature turned off, but you have to give them something.


Yes, agree. As to the rest of your advices. But giving them to me, it's
not nessecery. I know that already. But you can give them to the OP, as
he seams to need some advice :-)

--
/Arne
Jul 23 '05 #16
Andromeda wrote:
I appreciate all the articles here, but none of these seem to answer
my original question.
Welcome to usenet. In ciwah, we discuss www authoring. If the discussion
happens to answer a question you have, so much the better.
And no, I am not new around here.


In that case, you should already know that it is good manners to quote
some of the message you are replying to (as I've done in this post). So,
why didn't you do it?

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #17
Arne wrote:
Brian said:
Large popular sites do lots of dumb things. I wouldn't recommend
that anyone copy them.

But still most of them do that. That's the main reason why the
majority don't disable JS. I don't like it, you don't like it, but
it's the fact.


It is also a fact that some user agents do not process javascript.
Creating proper web sites -- including proper fall back for non-js
situations -- is not based on idealism. On the contrary, it is about
writing for the web as it exists now. You keep saying that you agree
that one mustn't rely on js, but then adding that such idealism is not
based on the "average" user, whatever that means.
I hope you understand that I agree with you how it should be. I just
don't belive it's so, and also wonder how it can be like it should


It doesn't matter whether you think users should or should not enable
js, or whether other sites do or do not rely on js for some aspect of
their site. Proper web sites prepare for all contingencies.

--
Brian (remove "invalid" to email me)
http://www.tsmchughs.com/
Jul 23 '05 #18
I'm reading a lot of bickering back and forth and no one has answered this gentleman's question.

There is a bad script floating around out there and no one can do anthing about it. Is there or is there not a solution to the 16-array limit?

Thanks!!
May 3 '06 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Richard | last post by:
The style sheet shown below is from the suckerfish vertical menu. http://www.htmldog.com/articles/suckerfish/dropdowns/example/vertical.html I've added in a few minor changes to color code the...
2
by: Brian | last post by:
Hello, I want to design some menus for websites with submenus. I'd like to learn the code myself and I was wondering a good place to pick up on some tips on how to design them. Also, is there...
6
by: pete | last post by:
Hello, I need resources for the following and would be appreciative to anyone that can help!!!! 1. a free website that clearly & comprehensively explains the DOM 2. a free website that has...
3
by: unurban | last post by:
I have a javascript menu based off of unordered lists that only shows the subnav links when you click on the main nav links. is there a way to keep any subnav items open after you click on a link...
2
by: Angelos | last post by:
Hello there.. I have the folowing piece of javascript that hides all my ul elements in a menu of the folowing structure: <ul> <li><a href="#">Page</a> <ul> <li><a href="#">Add</a></li> <li><a...
5
by: Sura | last post by:
Hi I have designed a simple DHTML menu which comes over a flash animation when it appears. I have set the window mode as transparent in the flash project. This menu is showing fine when seen...
1
by: Joe | last post by:
Hi, I am using asp.net Menu component to create a horizontal drop-down menu. Generally if when use DHTML menus like http://www.twinhelix.com/dhtml/popupmenu/, if you are embed a flash or...
2
by: farseer | last post by:
Hi, have seen some sites where there exists DHTML Tree view menus that smoothly and eloquently slide up and down when a user expands or collapses a node. I am wondering how this is done? The...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.