Forum Moderators: open
However, you can insert an
a element with an href attribute and close it without keying any text (thereby eliminating any underlined links)...<a href="mylink.htm"></a>...which would still allow the bots to follow the link and it will validate HTML 4.01/XHTML 1.0 Strict.
Still, we haven't overcome the issue that you pointed out -- having javascript in the page. That is where the target audience may come into play. In the example I used, the target audience user agents must/will have javascript enabled.
I would like to believe there is a better solution, without using javascript, and am very anxious to follow this thread. Therefore I am eagerly awaiting paste's response to your question...
paste: give me a better idea what you want to achieve? e.g post the code for the div you want to make into a link.
href and it would work as well as validate. However, this solution won't validate if you have other markup within the a element. For example, the following won't validate:<div style="cursor: pointer;">...and at this point it would be safe to say that we are pushing beyond "normal" usage as txbakers stated earlier. I did find at one time, however, that I wanted this type of feature. That's when I employed the javascript solution that works as well as validates:
<a href="mylink.htm" style="text-decoration: none;">Text
<ol>
<li>Text</li>
<li>Text</li>
</ol>
</a>
</div>
<div style="cursor: pointer;" onclick="window.open('mylink.htm','_self')">
<ol>
<li>Text</li>
<li>Text</li>
</ol>
</div>...leaving two issues in my mind. The desired effect is to have a block of markup become a link, for whatever reason. Other solutions may be to put a different background or border around the div and include an
a element or maybe a button to click as opposed to having the entire div being a link, but these are workarounds and not what paste is after. Good discussion...
But since you can link a graphic, why not:
a) write the div as normal with no links
b) write a second div which fits exactly over the top using z-index.
c) In the second, top-most div place a transparent gif and link the transparent gif to your desired location.
I think this might result in the effect you are looking for.
Your post says that 10% of users have javascript disabled.
Frankly, I have seen this number bandied about on discussion forums before and think it's a bunch of baloney. A myth.
I have worked and consulted for a lot of companies with users totaling in the hundreds of thousands and none of them enforced a policy of no javascript.
If you are quoting a reputable source on this, I'd be interested in knowing who or where.
thanks.
rich
Since there is a distinct lack of global visitor statistics on the web I suspect that it is a figure which has largely been made up. :)
I did a little Google digging and I've found references to it being as high as 18%.
Looking at the "Global Stats" on counter.com helps a little.
For this March 2004 "javascript false" is currently sitting at 6%, but it fluctuates a lot, in December it was at 13%.
Here's a couple of WebmasterWorld threads discussing it:
TheCounter.com Javascript tests [webmasterworld.com]
Percentage of users who have javascript disabled [webmasterworld.com]
Regardless of the precise figure, the fact remains that a 'reasonable percentage' of surfers have javascript turned off. Some will be forced to do so by company policy, some will turn it off themselves to get rid of pop-ups and other annoyances, others may have 'security products' that block javascript, and others will be using browsers which do not handle javascript (phones, PDAs, TV browsers, text browsers, accessibility tools).
Plus spiders don't 'do' javascript, so if you use javascript for links then you'll need to supply some alternative anyway.
If the source of this nonsense is thecounter.com, remember that thecounter only measures individual pages for their subscribers. Hardly a valid statistical sampling. Further, what's their methodology?
One website recently reported this :
"Do you use Java or JavaScript? If so, do you know how many people have browsers that run them? TheCounter (Feb 2004) reports these levels of support:
Javascript Support: 5% disabled, 95% enabled
Note: TheCounter's stats have fluctuated wildly recently, likely indicating major changes in how TheCounter determines their availability."
Hey, "phones, PDAs, TV browsers, text browsers, accessibility tools" are one thing. But I simply will not buy a figure of 10% for users of IE, Moz, Opera, etc... having javascript turned off. It's nonsense, really.
Anyone who's done desktop support and worked face to face with real live users will tell you two things:
-Users very seldom change program defaults.
-By and large, users are AFRAID to fiddle with program settings.
And as a corporate consultant and network engineer/administrator myself, I've never been in an environment where javascript was turned off as a matter of company policy.
What for?
For IE users, I would have a hard time buying a number greater than one in a thousand users. If someone says otherwise, I want to know how they arrived at that number.
'nuff said
phones, PDAs, TV browsers, text browsers, accessibility tools" are one thing. But I simply will not buy a figure of 10% for users of IE, Moz, Opera, etc... having javascript turned off.
It doesn't say that they are ALL using IE/Moz/Opera, it just says that there is a significant percentage of people who want to view your site that may not be able to if you rely on Javascript.
Having said that, I frequently turn off Javascript when I hit an annoying page and often forget to turn it back on. It is very easy to turn javascript on/off in Opera, just F12, then a single click.
I've never been in an environment where javascript was turned off as a matter of company policy.
What for?
You may not have seen a policy regarding Javascript directly - but I'm sure you must encountered paranoid IT managers who insist on setting the 'Security' level in IE to 'High'?
Indeed Microsoft describe the High setting as "The safest way to browse, but also the least functional. Less secure features are disabled." - and one of those disabled features is Javascript.
I'm sure even 'afraid' users might be tempted to bump up the security level slider in light of the recent virus attacks.
Likewise I understand that some of the various 'internet security suite' products will turn off javascript on tighter settings.
I just wanted to cap off the javascript thing: I consider it good practice to make sure all aspects of a site are accessible, even without javascript.
I also see your point about how easy it is to disable jscript in IE by cranking security up to HIGH. didn't realize that until you mentioned it.
My beef is that none of us should be designing sites based on apocryphal numbers regarding user habits.
It's amazing how myths persist. A few weeks ago, I wanted to incorporate an iframe into a page and my new supervisor said, "But Netscape 4 users won't be able to see it!" But after hauling out the site analysis logs, I showed him that his fear was groundless.
'nuff said
... now how about that z-index thing, did anybody try it?