PDA

View Full Version : W3C Validation Help


steviedifranco
06-10-2003, 08:36 AM
I'm getting error messages when I'm trying to validate my page which I don't understand. I'm validating as XHTML Strict. Here's my errors:

Line 21, column 151: document type does not allow element "div" here; missing one of "object", "ins", "del", "map", "button" start-tag

...and the line...

<a href="index.asp" class="nav"><div class="buttonnormal" onmousedown="downeffect(this)" onmouseover="upeffect(this)" onmouseout="normaleffect(this)">Main Directory</div></a>

--------------------------

Line 37, column 67: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag

...and the line...

<input size="5" maxlength="10" name="symbol" class="side" />

My other errors are similar, so if anyone knows what's wrong here I should be able to figure the rest out. Please help. Thank you.

Sardtok
06-10-2003, 12:00 PM
First one,
try putting the div outside the anchor...
I think that might help, but I might be wrong,
it's not a div in a div? That maybe could be a problem.
The problem isn't the div, but one of the tags that it is nested in.

Really weird though, missing start-tag...
You don't have an extra end tag somewhere?

steviedifranco
06-10-2003, 12:24 PM
Putting the <div> inside the anchor worked...I was trying to make the entire <div> be a link, but even though it worked, it wasn't valid.

How do I make a link open in a new window with XHTML? Using the "target" attribute is not valid in XHTML Strict. Any ideas?

Sardtok
06-10-2003, 12:37 PM
Well,
you could use javascript (ecmascript or jscript or what ever name and version you prefer (ecmascript is a new standard for the javascript language, jscript is Microsoft's "look we copied what someone else did" version of javascript, just in case anyone was wondering))...
There is probably a better way that is part of xhtml, but I don't know what it is (I haven't even learned the differences between xhtml and html (except for the all tags must be closed difference))...
Guess I'll have to read the specs on w3c,
and maybe I should learn svg too...
Hmm,
just thought of a great idea for animation,
using svg and java and jmf,
might just even be a good idea... ;)

steviedifranco
06-10-2003, 12:46 PM
Okay, I'm having the same problem 4 times on my page. Can you see what is wrong here?

Error messages...

Line 43, column 148: document type does not allow element "form" here; missing one of "object", "ins", "del", "map" start-tag
...5534&amp;site=logo&amp;promo=english">
^
Line 44, column 34: document type does not allow element "a" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
<a href="http://www.weather.com"><img src="images/weather.gif" alt="The Weathe
^
Line 44, column 122: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
...nnel" style="border: 0px" /></a><br />Enter ZIP Code:<br />
^
Line 44, column 123: character data is not allowed here
...nel" style="border: 0px" /></a><br />Enter ZIP Code:<br />
^
Line 44, column 143: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
...0px" /></a><br />Enter ZIP Code:<br />
^
Line 45, column 63: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
...name="destination" type="text" size="6" class="side" />
^
Line 46, column 64: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
...pe="submit" alt="go!" value="Forecast" class="side" />
^


...and the code...

41: <div class="weather">
42: <p style="text-align: center" class="sideheading">
43: <form method="post" action="http://www.weather.com/cgi-bin/uncgi/zip_city_search.cgi?par=internal&amp;code=685534&amp;site= logo&amp;promo=english">
44: <a href="http://www.weather.com"><img src="images/weather.gif" alt="The Weather Channel" style="border: 0px" /></a><br />Enter ZIP Code:<br />
45: <input name="destination" type="text" size="6" class="side" />
46: <input type="submit" alt="go!" value="Forecast" class="side" />
47: </form></p>
48: </div>

Sardtok
06-10-2003, 03:05 PM
First try putting the div and paragraph inside the form,
this shouldn't visually change anything,
but it is possible that it's not legal to put it inside a div or a paragraph.

It's possible that that will fix all the errors,
and it's possible that I am completely wrong.

steviedifranco
06-11-2003, 06:24 AM
Excellent, those suggestions made my page valid. Thank you very much.

However, now I remember why I put those <form>'s, <div>'s, and <p>'s in the order that I did. When I did not do the order that I previously did, there would be an added paragraph break after each form. How do I get rid of that? Is this always going to be a problem? I've had this problem forever.

steviedifranco
06-11-2003, 06:25 AM
By the way, even thought the address is on the other thread, the address for the page is:

http://www.ohioconnect.net/template.php

if you'd like to see what I'm talking about.

Sardtok
06-11-2003, 09:29 AM
As I said in the Netscape thread, if you don't need the break at the end,
don't use the paragraph tag (it's what it's for),
instead try using span,
if you have set some css code to <p> just set it to span as well,
or to a class or use inheritance to get the wanted effect (this could be useful if you need to specify some extra css in the xhtml code).

For instance:
div span { style }

Because the span will be a child of div this would work,
it is possible that you'd rather want something like:
.myclass span { style }

Then span elements that reside inside a tag of class myclass will get the wanted style.

steviedifranco
06-13-2003, 07:35 AM
<span> did not work. However, in my style sheet, I did this:

form { padding: 0px ; margin: 0px ; }

The spaces are now gone.