View Full Version : XHTML Validator questions

Grant Palin
11-22-2002, 06:46 AM
I ran my framed website through the W3C XHTML validator. it returned 3 errors: no attributes called framespacing and frameborder. Also, it says the element <noframes> is not allowed. What's going on? Here's the link to the result page, with the error highlighted: check it out, and please let me know of any solutions.


11-22-2002, 09:12 AM
Framespacing is deprecated in xhtml 1.0 strict. Frameborder and noframes were in the wrong place.
This is valid:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Heroes of Might and Magic 1" content="HOMM, Heroes of Might and Magic, A Strategic Quest, artifacts, heroes, troops, castles, towns, spells, skills, scenarios, campaigns, pictures, strategies, cheats, links, downloads, where to buy, 3DO, New World Computing, NWC" />
<frameset cols="12%, *">
<frame src="pagelinks1.html" name="left_frame" scrolling="no" frameborder="0" noresize="noresize" />
<frameset rows="13%, *">
<frame src="pagelinks2.html" name="top_frame" scrolling="no" frameborder="0" noresize="noresize" />
<frame src="home.html" name="bottom_frame" scrolling="auto" frameborder="0" noresize="noresize" />
<p>Your web browser does not support frames. To view the the site, you should use the <a href="SiteMap.html">Site Map</a></p>

11-23-2002, 01:49 AM
I would avoid frames anyway (I posted a few times regarding this subject on the old forums!). I just think they cause many more problems than they solve (look up something like "pros and cons of frames" on google), although there are a few (rare) valid cases where they are the best option.

I would use include files, or (if you can't use server side scripting at all, or even SHTML includes) javascript includes for menus, etc. before I would use frames.

I would opt for getting an SHTML enabled host at the very least, though. :)

Grant Palin
11-23-2002, 04:41 AM
MCookie, thanks for those fixes. The page validates now. However, I have a small problem. I was using the framespacing attribute to keep my frames up against each other, but now, without that attribute, they are slightly spaced apart. Do you know how that can be fixed? Take a look at the page I've been talking about and you'll see what I mean: there's a small white border between the frames.


Whammy, thank you for your input. I have weighed the pros and cons of using frames before. I even asked here about it some time ago. One good thing about them is that they keep all the navigation in sight, whereas if I included the navigation stuff on the same page, you would have to scroll to find it. I've thought of using Javascript includes, but the possible downside is that they would not work if someone has javascript disabled in their browser.
I've tested my frames fairly carefully (at least, I think so), and everything goes where it's supposed to.
I don't know anything about server-side, so that's out. Although I have heard about Server-Side Includes. What would you suggest?

11-23-2002, 05:13 AM
Well, that is one of the pros about using frames for navigation - it doesn't move. :)

Other than that I guess it all really depends on the site, and weighing what you like about them against the cons. If you want people to be able to bookmark individual pages, or you are using a lot of frilly javascripts (which thankfully you aren't!), forget them. :)

Grant Palin
11-23-2002, 05:17 AM
What's wrong with javascript with frames???

I have another problem now. I'm trying to validate the two pages that contain navigation links: the top frame, and the left frame. They are named PageLinks1 and PageLinks2. When I run those pages though the validator, I get the same two errors for each: the body element is not allowed, and missing a required sub-element of the HTML tag. Could you please have a look and point out to me what's wrong? I've looked them both over a few times, and I haven't got a clue. Here are the lnks to each int he validator:



11-23-2002, 11:18 AM
Be sure to use the right DTD. For a frameset page, you need the frameset DTD. But on other pages, use the strict or transitional DTD. If you use a frameset DTD, the validator looks for a frameset. If it isn't there, your page won't validate.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

But when you've put the right DTD there you'll get these results for Pagelinks1.html:

Line 21, column 17:
<body background="NavGradient.jpg">
Error: there is no attribute "background" for this element (in this HTML version)

Line 23, column 17:
<script language="JavaScript1.2" type="text/javascript">
Error: there is no attribute "language" for this element (in this HTML version)

Line 53, column 7:
Error: element "center" not defined in this HTML version

Line 58, column 34:
... <a href="screenshots.html" target="bottom_frame"><img src="s ...
Error: there is no attribute "target" for this element (in this HTML version)

Line 58, column 50:
... enshots_button.jpg" width="75" height="34" border="0" alt="Screenshots ...
Error: there is no attribute "border" for this element (in this HTML version)

What to do?

* 'background' is deprecated. You should use CSS for background images.

* 'language' is deprecated. But <script type="text/javascript"> will validate.

* 'center' is also deprecated. Use text-align:center or margins..

* 'target'. Deprecated. Very important attribute when using frames. You need it. But, other then using JS, I've not yet seen a way to open pages in another window using xhtml strict.

* 'border' Deprecated. Use CSS.

For using frames, you need the framespacing and the target attributes. But these attributes don't exist in xhtml strict. Now, maybe there's a way to get rid of the framespacing, I'm not sure, but I don't think you can get around the deprecated target attribute. I think you have to make a decision here. No frames and xhtml or frames and html 4.01.

Grant Palin
11-23-2002, 06:45 PM
Thanks for that, MCookie. I've put the Transitional DTD on all of my pages except the frameset page (index). The Index, Pagelinks1, and Pagelinks2 pages all now validate without errors.

Do those deprecated elements apply to XHTML Transitional?

Grant Palin
11-27-2002, 02:19 AM
Okay, I've been doing a little thinking about this.

Background, language, center, and border will be easy enough to fix (I've even done some of it now).

Like you said, that target attribute will be a bother. I've been playing around with my HTML, and I've got a few ideas.
1. I could just re-insert those framespacing attributes into my frameset, and remove the XHTML DTD from my page. The downside is that it will then not be XHTML compliant.
2. I could put all my navigation links into tables. The major downside here is the maintenance involved in changing the navigation links in each page.
3. I could try using an IFRAME. I wouldn't mind trying it, since I've never used it before. But, first, I don't know if XHTML supports this. Second, I understand it is not supported by many browsers.
4. I tried using Javascript includes to automatically insert the navigation links onto the content pages themselves. This worked, but I could tell that it was just a tad slow. Plus, it wouldn't work for users who do not have Javascript enabled.
5. I've also investigated the possibility of server-side includes. It sounds like a good idea. But I'm not sure if it would be the absolute best things to do. Any opinions?

If there are any other possibilities that I've missed, please post them!

By the way, I'm using XHTML Transitional for the content pages, and frameset for the frameset page.

11-27-2002, 02:22 AM
Server-side includes are the best way to go, if you have the ability to use them.

target="whatever" has to be hacked right now for xhtml compliance, due to there being no XHTML equivalent. I usually use javascript i.e.:

<a href="javascript:void window.open('link here')">link</a>

Until they decide what to do about "new windows", etc. and frames shouldn't be a problem to manipulate with js.

Grant Palin
11-27-2002, 02:37 AM
Thanks- I'll look into SSI.

Now, that javascript targeting sounds good, but what about that number of users without javascript enabled? Or is that too few to worry about?

And, why the heck does XHTML not support the target attribute? That seems rather dumb to me.

11-27-2002, 02:38 AM
It seems dumb to me too... lol. As far as users using javascript, I suppose there may be a way to support it using a regular link as well, although I haven't messed with it.

Grant Palin
11-27-2002, 02:43 AM
I already have a site map for my site- should I just direct non-Javascript users to use the sitemap to navigate, rather than through the framed page?

Or maybe I could just ignore the non-compliance of the target attribute. Would the site still work for viewer, even though it wasn't compliant?

I could just leave it for now and work on a long-term fix, couldn't I?

11-27-2002, 03:39 AM
Originally posted by Grant Palin
And, why the heck does XHTML not support the target attribute? That seems rather dumb to me.

I believe it was decided that ultimately the user should decide whether or not to open a link in a new window.

I don't fully understand the decision myself, but I'm sure there was at least some good reasoning behind it.

Grant Palin
11-27-2002, 03:44 AM
Well, that's crazy! Doing that, they've just about killed frames! Frames are almost useless without the target attribute, aren't they?!?

11-27-2002, 03:48 AM
Actually I believe it was a case of what jkd said... they believe "The user should decide if they want to open a new link in a new window".

All well and good, theoretically, but what if the user is not internet savvy and doesn't know how to "shift click" a link?!?

I read the arguments, but I don't agree with them at all being a web designer.

I know most of my clients would prefer to keep their website open when providing a "reference link", for instance... (to keep the customer on their site as long as possible!) and I think that not allowing a non-javascript "compliant" method for opening new windows in XHTML is a terrible oversight that will hopefully be shortly remedied in XHTML 2.0 or whichever version comes next... (perhaps by allowing the "target" attribute again?) but until then, you can either go with XHTML transitional, or just trust that your "non-savvy" users will have javascript enabled... after all if they are not "'net savvy" then they won't know how to turn off javascript anyway, hopefully... sigh

Grant Palin
11-27-2002, 03:52 AM
No offense, but I'm talking about frames! I'm not so worried about opening a new window.

11-27-2002, 03:53 AM
P.S. regarding frames, you can still manipulate them perfectly with javascript... that's another oversight they made with the target attribute though... and "new window", or "frames", it all amounts to the same thing... an oversight.

It's all well and good to try to get back to the "roots" of markup - but some things are just necessary and they failed to consider a couple of them, like "what about users that don't have javascript enabled?". :rolleyes:

Grant Palin
11-28-2002, 05:48 AM
Another question regarding validation. I'm trying to validate another page, but I get a message saying these are not defined for the BODY tag, and I need them, for certain features of my page. How would I fix that? Can I do this via CSS?


11-28-2002, 06:10 AM
html, body {
margin: 0;

Grant Palin
11-28-2002, 07:17 AM
And that does exactly the same thing?

11-28-2002, 06:43 PM

Grant Palin
11-29-2002, 02:57 AM
Thank you! That did the trick!:thumbsup: