473,382 Members | 1,814 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,382 software developers and data experts.

Multi-function Menu Question

Its perhaps a bit early to ask, since I'm still doing the page design
and haven't got down to the coding yet, but I wonder if anyone can help
with a bit of a question. To lay the groundwork, a quick description of
the template design for the pages:-

1. There will be a body section of the page consisting of a set of <div>
layers. The top level layers will all have the same CSS class to ensure
a common design look.

2. At the side or top of the page (not yet decided) there will be a
small number of navigation text phrases. These will be set up as
<a>ddress tags to that they can have events attached.

3. The events on the navigation menu will be "onClick" events and will
switch the layer they refer to to be visible (and the others to be
invisible, obviously).

4. The reference on the address tags should, I know, be of the form
"href='javascript:;'" to prevent page reloads when clicking on the menu
option since I have an "onLoad" event to set up the basic page. No
problem here - I've made pages like this loads of times.

5. Now comes the fun bit... I want the pages to be fully accessible to
anyone at all (which is why the menu is text rather than images in the
first place). That has to include people who do not have
JavaScript-enabled browsers.

So - I will start loading the page with all the <div> layers visible
(the onLoad event will switch off those not initially in use). These
will switch in and out of visibility for browsers using JavaScript. For
those who don't use JavaScript, the page will display with all layers
visible, of course, and for these users the menu options should go to
anchor points at the top of each top-level layer section.

Now - the question is, how can I use anchor points (of the form
"href='#anchorname'" and yet still prevent page-reloads when the menu
option is selected? I know that some browsers will not do page reloads
anyway, but I need to be sure that none will. Any ideas?
Jul 23 '05 #1
2 1698
Mark Preston wrote:
<snip>
4. The reference on the address tags should, I know, be of the form
"href='javascript:;'" to prevent page reloads when clicking on the
menu option since I have an "onLoad" event to set up the basic page.
No problem here - I've made pages like this loads of times.
Absolute rubbish. This group strongly and repeatedly discourages the use
of javascript pseudo protocol HREFs, partly because they offer no
facility for clean degradation (or meaningful actions without javascript
being enabled) and partly because they directly cause problems with some
browser and OS combinations:-

<URL: http://jibbering.com/faq/#FAQ4_24 >

And that particular formulation of a javascript pseudo protocol HREF -
"javascript:;" - can be demonstrated to directly produce internally
suppressed syntax errors on IE 4 & 5 (it probably produces them on later
versions but the facility for the demonstration was removed).
"javascript: void 0;" would be better as it will not represent a syntax
error (but preferably don't use javascript HREFs at all, ever).
5. Now comes the fun bit... I want the pages to be fully accessible to
anyone at all (which is why the menu is text rather than images in the
first place). That has to include people who do not have
JavaScript-enabled browsers.
You might consider that to be fully accessible it would be necessary to
facilitate keyboard navigation, and apparently not all javascript
capable/enabled browsers trigger onclick events when a currently focused
link is triggered via the keyboard (at least some older ones don't).
Doubling-up with a keydown/press event might be advisable (with
appropriate handling for the browsers that will trigger onclick in
addition to key events).

<snip> Now - the question is, how can I use anchor points (of the form
"href='#anchorname'" and yet still prevent page-reloads when the
menu option is selected? I know that some browsers will not do
page reloads anyway, but I need to be sure that none will. Any
ideas?


Placing a fragment identifier in the HREF is the most sensible thing to
do. It does not need to conflict with the javascript in the onclick
handler because the onclick handler is allowed to prevent the navigation
using the HREF by cancelling the click event, usually be returning false
from the handler (possibly with additional W3C DOM and IE specific
default action cancelling code).

See:-

<URL: http://www.litotes.demon.co.uk/js_info/pop_ups.html >

- for an example resembling what you are describing (note: the first
link will re-load the page with the script disabled and so can be used
to simulate interaction without javascript).

Richard.
Jul 23 '05 #2
Richard Cornford wrote:
Mark Preston wrote:
<snip>
4. The reference on the address tags should, I know, be of the form
"href='javascript:;'" [snip]
Absolute rubbish. This group strongly and repeatedly discourages the use
of javascript pseudo protocol HREFs, partly because they offer no
facility for clean degradation (or meaningful actions without javascript
being enabled) and partly because they directly cause problems with some
browser and OS combinations:-

I do know that... if you read on, you will see that the entire point of
the question is all *about* "clean degredation" rather than Javascript
HREFs. It just happens that - as I said - in the past I have used them a
lot (because they happen to be pretty much "built-in" to DreamWeaver MX)
and would prefer *not* to any more.
And that particular formulation of a javascript pseudo protocol HREF -
"javascript:;" - can be demonstrated to directly produce internally
suppressed syntax errors on IE 4 & 5 (it probably produces them on later
versions but the facility for the demonstration was removed).
"javascript: void 0;" would be better as it will not represent a syntax
error (but preferably don't use javascript HREFs at all, ever).
This is actually what I initially replaced my "javascript:;" references
with when the glitch in IE became clear. But it isn't good enough for
non-enabled browsers, which is why I want to go further... hence my
question in the first place.
5. Now comes the fun bit... I want the pages to be fully accessible to
anyone at all (which is why the menu is text rather than images in the
first place). That has to include people who do not have
JavaScript-enabled browsers.
You might consider that to be fully accessible it would be necessary to
facilitate keyboard navigation, and apparently not all javascript
capable/enabled browsers trigger onclick events when a currently focused
link is triggered via the keyboard (at least some older ones don't).
Doubling-up with a keydown/press event might be advisable (with
appropriate handling for the browsers that will trigger onclick in
addition to key events).

This is the sort of thing I've been looking for as an answer! I will
look into keyboard triggers and vocal triggers (vocal is likely to be
the most important, but either could apply). Thanks. <snip>
Now - the question is, how can I use anchor points (of the form
"href='#anchorname'" and yet still prevent page-reloads when the
menu option is selected? I know that some browsers will not do
page reloads anyway, but I need to be sure that none will. Any
ideas?


Placing a fragment identifier in the HREF is the most sensible thing to
do. It does not need to conflict with the javascript in the onclick
handler because the onclick handler is allowed to prevent the navigation
using the HREF by cancelling the click event, usually be returning false
from the handler (possibly with additional W3C DOM and IE specific
default action cancelling code).

See:-

<URL: http://www.litotes.demon.co.uk/js_info/pop_ups.html >

- for an example resembling what you are describing (note: the first
link will re-load the page with the script disabled and so can be used
to simulate interaction without javascript).

Got it! That is EXACTLY the sort of link I was looking for. I've also
found out that the Mozilla core engine since version 0.7 has been
updated to stop a glitch it had that caused page reloads with some fixed
anchors, so that solves that one as well. Unfortunately, it does still
seem to do page reloads at fairly unpredictable times if you mess around
with keyup/keydown events. There's still a little trouble with Lynx, but
that should sort out this week.

Thanks for the ideas and link.
Jul 23 '05 #3

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

Similar topics

37
by: ajikoe | last post by:
Hello, Is anyone has experiance in running python code to run multi thread parallel in multi processor. Is it possible ? Can python manage which cpu shoud do every thread? Sincerely Yours,...
4
by: Frank Jona | last post by:
Intellisense with C# and a multi-file assembly is not working. With VB.NET it is working. Is there a fix availible? We're using VisualStudio 2003 Regards Frank
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
0
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
6
by: Joe | last post by:
I have 2 multi-list boxes, 1 displays course categories based on a table called CATEGORIES. This table has 2 fields CATEGORY_ID, CATEGORY_NAME The other multi-list box displays courses based on...
4
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
0
by: Sabri.Pllana | last post by:
We apologize if you receive multiple copies of this call for papers. *********************************************************************** 2008 International Workshop on Multi-Core Computing...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
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
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.