A Conversation for Website Developer's Forum

Javascript and XHTML

Post 1

Nireena

H'lo all. Sorry to bother you again with another XHTML question, but this time it's about Javascript. I've got a navigation bar along the bottom of my pages and since I change it pretty frequently I do it using JS so that I don't have to change it in every page each time. The line looks like this:



Now, the W3C validator points out that I need to add :

type="javascript"

in there. However, when I do that the navbar no longer shows up in IE 6 even though the validator is now happy with it. Is this a quirk of IE 6? Is there a workaround that will make both the browser and the validator happy?

Thanks,
smiley - star


Javascript and XHTML

Post 2

dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC

type="javascript" ?

Shouldn't it be

type="text/javascript"

I don't have IE 6 (I'm using a Mac) so I can't test that out for you.
smiley - dog


Javascript and XHTML

Post 3

Nireena

smiley - blush

Yeeup, that would do it. Works fine, and now the pages validate 100%. Amazing the difference a few characters makes...

Thanks!
smiley - star


Javascript and XHTML

Post 4

Ion the Naysayer

Looks like you have a solution but I think you need to ask yourself about accessibility on this one. I haven't seen the page but doing this in JavaScript seems like an inaccessible thing to do since you're writing content to the page after it's already loaded.

Have you ever used Server Side Includes? If you add a server side include directive you can include snippets of HTML into your pages from separate files.

<!--#include virtual="navbarfile.html"--> would be the appropriate directive. You do have to have a server/service provider that supports this, however. Some disable it because it can be a security risk. Also, if you're running under IIS make sure all your files have an extra carriage return at the bottom or it will cut off parts of your document.


Javascript and XHTML

Post 5

HappyDude

or if SSI is not avaiable you could just use the tag to put a link to a "menu" page smiley - winkeye


Javascript and XHTML

Post 6

Pastey

Accessibility is going to become a major issue on the web in the not too distant future.

There are already grumblings about having to make everything accessible. One of the major arguements against it is that why should web developers be forced to do this when companies that produce magazines, catalogues and other products don't have to?
They don't have to, but often it's in their best interest to.

Personally I think that the majority of the web should be designed to be accessible, but there are some sites where it's either impractible or just not relevant.

smiley - rose


Javascript and XHTML

Post 7

Nireena


H'lo all.

Yes, I've wondered about accessibility, too. One of my long-term projects for the site is to make it Bobby-approved. I've run it past Bobby already and was dismayed at the amount of critiques that were returned. I don't remember javascript used in this way as one of the problems, but I'll keep it in mind when I do the accessibility overhauls. My host does allow SSIs so I'll use those instead.

smiley - cheers
smiley - star


Javascript and XHTML

Post 8

Ion the Naysayer

I think the grumblings are irrelevant, myself. Why create something that's not accessible when you have an alternative that is just as easy (or I would argue easier if we're talking about JavaScript vs. SSI) and is perfectly accessible?

Creating a webpage that's accessible by following the accessibiliy guidelines on the W3C's website is trivial and low cost. Printing a braile magazine or catalogue is not. If equal access will cost practically nothing and increases your potential visitor base, it doesn't make sense not to create accessible webpages.

If impracticality is the only reason for a site not to be made accessible, perhaps a look at why the site is designed that way is required. To me, impracticality implies poor design.

Then again I've had enormous amounts of trouble trying to find a screen reader that I can use for testing my websites that doesn't cost an arm and a leg, so maybe impracticality is not just an issue of site design.


Javascript and XHTML

Post 9

Ion the Naysayer

URL for Bobby accessibility checker: http://bobby.watchfire.com/bobby/html/en/index.jsp


Javascript and XHTML

Post 10

dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC

One of my favorite Donald Norman quotations is something along the lines of "if you design for the disabled, the end is result is often better for everyone". His philosophy is that if you pay attention to the needs of the user population you won't make the awful usability mistakes that people commonly make, even if the population you are designing for has special needs.

http://www.nngroup.com/
smiley - dog


Javascript and XHTML

Post 11

Frankie Roberto

Dunno, I think that stairs are a pretty good invention...


Javascript and XHTML

Post 12

dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC

Indeed they are, but the elevator is a better one.
smiley - dog


Javascript and XHTML

Post 13

Ion the Naysayer

I think it's hard to say that elevators are "better" than stairs or vice-versa. Stairs are good where you have a short distance that you know won't have to be climbed by anybody with a disability because they're much more energy efficient and much faster for shorter distances. Ramps are also good because they have most of the benefits of stairs, plus accessibility but ramps also take up a lot of space.


Javascript and XHTML

Post 14

Frankie Roberto

I was being a bit facetious, but you're right there are always different advantages/disadvantages. I was suprised to learn that escalaters are really effecient. Apparantly the tube couldn't operate if all of the escalaters were stationary stairs (I just thought they were labour-saving).


Javascript and XHTML

Post 15

Pastey

Making a site accessible is something we all seem to agree on, but making it a legal requirement?

There are virtually no other legal requirements on the 'net. Okay, companies and hosts make their own requirements, as do countries, but there is no global legality invovled.


The US (I think this was last year), made it a legal requirement for all their federal sites to be completely accessible to people with disabilities. They are now currently trying to get this to reach beyond their own sites to those hosted within their borders, and in the past have taken their internet laws to other countries and taken other companies and individuals to court.
One of the even more scary aspects of this is that it's the web designer/coder that would be prosecuted, not the company the site is for. Even if the coder is told by the company that they don't want the site to have multi-access.


smiley - rose


Javascript and XHTML

Post 16

dElaphant (and Zeppo his dog (and Gummo, Zeppos dog)) - Left my apostrophes at the BBC

You're referring to "Section 508" guidelines http://usability.gov/accessibility/index.html#508 that require US federal sites to be accessible. It only applies to other non-government sites if they are federally funded (this would cover the post office, for instance, and several other "semi-private" institutions).

As far as I know, there is no effort to extend the reach of the law into the private sector (at least within US boundaries), and an attempt to do so would probably meet with significant legal problems. At the same time many US corporations are voluntarily following those guidelines or the W3 ones.

As for who would be liable, that's wrapped up in tons of complexities. Some government agencies (e.g., Congress) cannot be sued, and many simply pass their web sites off to a web-development agencies with the instructions to meet the guidelines. If the web developer doesn't deliver, of course the web developer is liable.
smiley - dog


Javascript and XHTML

Post 17

Ion the Naysayer

Global rules? Won't happen. And whether it's a good idea is very much a matter of debate. Anti-discrimination laws do exist for a reason though, and if these are applied to vital sections of the Internet (*.gov, any bank website, etc.) I don't think that's a bad thing.

This goes along with having wheelchair ramps / elevators on buildings in Canada. It's a legal requirement for some buildings (post office, public buildings, etc.) and a good idea for many others (churches, businesses, etc.).


Javascript and XHTML

Post 18

Nireena

H'lo again. Per somebody's suggestion (sorry, forgot who it was!) I was fiddling with SSIs to put a navigation bar at the bottom of each of my pages. (I'm currently using Javascript but apparently that's not as accessible.) I realized that there's a bit of a conflict on the pages that have PHP in them. The pages with PHP in them currently have a .phtml extension, but pages with SSIs need a .shtml extension.

I've found I can do the includes just as easily using

<?php include("navbar.html"); php?>

Would that be as accessible as SSIs since PHP is server-side as well?

Hope that's coherent. It's rather late here smiley - online2long

Thanks,
smiley - star


Javascript and XHTML

Post 19

HappyDude

I don't see why not smiley - winkeye

Re: accesibility give "Bobby" a whirl http://bobby.watchfire.com/bobby/html/en/index.jsp

and see the W3C 's Web Accessibility Initiative (WAI) pages
http://www.w3.org/WAI/


Javascript and XHTML

Post 20

Nireena

Cool. I think I'll use PHP on the pages that already have it, and use SSIs for the others.

Re: Bobby- already been there. It quite thoroughly trashed my site the first time around smiley - winkeye I've since made some changes, but I've got a long ways to go.

Thanks!
smiley - star


Key: Complain about this post