Computer Help forum

General discussion

Javascript:void(0) violates W3C validation standards?

by hcr62 / December 12, 2009 12:15 AM PST

I have been using (an example of) the following code for years:

<a href="javascript:void(0)" onmouseover="window.status='Lifes Covenant Poem'; return true;" onmouseout="window.status=''; return true;" onclick="'', 'covenant', 'width=469,height=483,left=25,top=75,toolbar=no,status=no,location=yes,menubar=no,directories=no,scrollbars=yes,resizable=yes')"><img class="mainimage" src="images/covenant.jpg" width="370" height="254" alt="Life's Covenant Poem" title="Life's Covenant Poem" /></a><br />

It seems that the void(0) code violates W3C standards relating to non-javascript users. I have no idea how to code around the requirement to show the desired page to a non-javascript user while maintaining the integrity and appearance of my site ( A specific instance of this code example can be seen in the page

Thank you for any help and/or advice.

Discussion is locked
You are posting a reply to: Javascript:void(0) violates W3C validation standards?
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Javascript:void(0) violates W3C validation standards?
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
It's just a tool.
by R. Proffitt Forum moderator / December 12, 2009 12:23 AM PST

I read the full text at and agree that it is just a tool.

Collapse -
But - "Tools" exist for a reason
by hcr62 / December 12, 2009 1:47 AM PST
In reply to: It's just a tool.

I, too, have read (and understand) the article written by Jukka Korpela ( I believe Mr. Korpela makes some good points, not the least of which is that validation, for the sake of validation, is meant to suggest that guidelines are being followed (depending upon the context, SGML/XHTML-XML/HTML/CSS etc). He states that the world changes, guidelines change, and what was once valid is now no longer valid. He relates this to the use of an icon on a site which indicates 'This site has been validated', and how this form of 'validation-proving' is both misleading and a dis-service to everyone.

But my question derives from the well-worn path of java versus non-java preferences on the part of the individual browsing the web. At one time, this was a paramount concern. It may no longer be this way, meaning most (99%) of the folks on the web have java enabled. But - the W3C validation tool suggests this IS an issue, and I'm left wondering how to code to circumvent those not using Java.

Thank you for sharing the web page authored by Mr. Korpela. It helps to review the use of tools and authenticate them when necessary, and/or reject those same tools when appropriate.

Collapse -
Even I write tools.
by R. Proffitt Forum moderator / December 12, 2009 2:02 AM PST

And while they exist for a purpose I think we see that we must use our own noggin at times and take the good with the bad. For example an automatic code analyzer I use faults this code.

if (thisistrue) i = 0;

The code analyzer wants this to be re-written as:

if (thisistrrue)
i = 0;

Sorry but the forum eats the leading spaces. But I share this as an example where we'll ignore that "error" for what it is.

Collapse -
Tools isn't the question...
by hcr62 / December 12, 2009 2:37 AM PST
In reply to: Even I write tools.

Thanks, Bob - I appreciate the merit of tools, and the problem with over-relying on them, too! You make a good point.

I am simply looking for an alternative way to code the routine I use, so that a) I retain the look and feel of the pages for those who use Javascript, and b) I provide a similar experience of some sort for those NOT using Javascript. Setting the use of the 'validity checker' aside for a moment, isn't there some way that an alternate approach can be coded?

I have played a bit with trying the scipt and noscript tags (see but this fails miserably. Just bracketing the code with script /script fails to display the image and link. I know I'm missing something obvious, but - what?

Collapse -
So why not? (link only)
by R. Proffitt Forum moderator / December 12, 2009 2:44 AM PST

Popular Forums

Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


Your favorite shows are back!

Don’t miss your dramas, sitcoms and reality shows. Find out when and where they’re airing!