473,395 Members | 2,006 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,395 software developers and data experts.

Coding javascript and css reliant UI elements

I'm pondering what the various drawbacks are of the methods to code UI
elements who's function relies on javascript and css.

Currently on http://www.pan-europe.utvinternet.ie/ I use styled <a>
elements to display two UI elements that via javascript select alternate
stylesheets that enable or disable the left utilities panel and/or the
navbar. (both are there for the convenience of desktop users, they are
not essential, likely to be a nuisance on narrow viewports or in aural
rendering)

Because these UI elements are useless when either javascript or css is
disabled I use js document.write for js off situations, css background
images for css off situations, css generated content or content wrapped
in a IE conditional comment for css2 aural renderers or IE based aural
renderers (content is positioned off screen).

The current method only displays small coloured boxes in images off
situations, but I'm ok with that.

I'm mainly pondering on the use of styled <button> elements instead of
styled links. Are there objections to using a form element like <button>
in a non form context?

Afaics a possible benefit of using <button> elements is that Opera has
separate keyboard controls for link and form elements, this potentially
allows a user quicker access to the UI controls, there is one (1 field +
1 button) search form on all pages and typically a lot more links to
step through.

The drawback I currently see is that the button element renders in css
off situations, whereas styled links disappear.

Currently I use href="javascript:void(function())" to activate the js
function, this causes the links to be included in the keyboard
navigation step sequence, if I use onclick then it (understandably)
doesn't in some browsers (IE and/or Mozilla IIRC). The drawback of using
href="javascript:void(function())" is that Opera displays that in it's
tooltip box, this I mainly consider an Opera quirk but I'd prefer to
avoid it if I could do so without causing other problems.

Any considerations I've missed?

--
Spartanicus
Oct 13 '05 #1
1 2126
Spartanicus wrote:
Because these UI elements are useless when either javascript or css is
disabled I use js document.write for js off situations, You mean css off situations? css background
images for css off situations, You mean js off situations?

And, do you have a really _good_ reason to be using js navigation?
Is it backed with <noscript> navigation?
I'm mainly pondering on the use of styled <button> elements instead of
styled links. Are there objections to using a form element like <button>
in a non form context?
Using a button outside a form _might_ result in it not working as you
intend in some browsers. Is there a reason you can't use form tags
around it?

Afaics a possible benefit of using <button> elements is that Opera has
separate keyboard controls for link and form elements, this potentially
allows a user quicker access to the UI controls, there is one (1 field +
1 button) search form on all pages and typically a lot more links to
step through.
Unless you're on an _intranet_ where most of your users are on Opera
_and_ trained to use keyboard shortcuts, I think any benefits to users
would be tiny. Upkeep of weird markup, on the other hand, is a pain.

The drawback I currently see is that the button element renders in css
off situations, whereas styled links disappear.
If the styling of links disappears with CSS off, I can understand. If
the links themselves disappear, you are doing something wrong.

Currently I use href="javascript:void(function())"
You mean
<button>
<a href="javascript:void(function())"
</button>
?

Why don't you remove non-essential stuff and post the code?
I can't make much sense of the following paragraph.
to activate the js
function, this causes the links to be included in the keyboard
navigation step sequence, if I use onclick then it (understandably)
doesn't in some browsers (IE and/or Mozilla IIRC). The drawback of using
href="javascript:void(function())" is that Opera displays that in it's
tooltip box, this I mainly consider an Opera quirk but I'd prefer to
avoid it if I could do so without causing other problems.


--
mbstevens
http://www.mbstevens.com
Oct 13 '05 #2

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

Similar topics

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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.