Valid HTML! HELP?

kiko_friendly

New Member
<!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" lang="en" xml:lang="en">


The code above that I put in red is similar to the code that I need to use for my site.

I am currently validating my HTML, which is complicated for me because I only taught myself HTML so as it would look right, and not to be valid...there was no other way (unless I paid).

Anyhow, I've managed to get my page to very few errrors, but I have no idea as to what the code above is. All I know is that I want to be able to use the following without it complaining :

<SCRIPT LANGUAGE="JavaScript">

The validator then said this :

Error Line 146 column 17: there is no attribute "LANGUAGE".

<SCRIPT LANGUAGE="JavaScript">

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.


and

Error Line 146 column 29: element "SCRIPT" undefined.

<SCRIPT LANGUAGE="JavaScript">

You have used the element named above in your document, but the document type you are using does not define an element of that name. This error is often caused by:

* incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Frameset" document type to get the "<frameset>" element),
* by using vendor proprietary extensions such as "<spacer>" or "<marquee>" (this is usually fixed by using CSS to achieve the desired effect instead).
* by using upper-case tags in XHTML (in XHTML attributes and elements must be all lower-case.



That just confuses me. :(

Any help, anyone?
 

hschmitz

New Member
Hi kiko_friendly,

the error you showed is caused by upper-case tags. In XHTML all tags (and I think also the attributes) MUST be lower-case.
Also the language attribute is considered deprecated and the type attribute should be used instead.

So instead of

<SCRIPT LANGUAGE="JavaScript">

it should read

<script type="text/javascript">

Hope this helps
 

qadisha

New Member
Validating HTML

I suggest you use the following as DOCTYPE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

It is more flexible than the "Strict" type and it will easier to have a valid HTML page.

Also, you don't need to pay big money to learn correct HTML. You can find plenty of tutorials on the web and perhaps also invest in a book. The one which helped me most is called : Head first HTML with CSS and XHTML.
 

kiko_friendly

New Member
I suggest you use the following as DOCTYPE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

It is more flexible than the "Strict" type and it will easier to have a valid HTML page.

Also, you don't need to pay big money to learn correct HTML. You can find plenty of tutorials on the web and perhaps also invest in a book. The one which helped me most is called : Head first HTML with CSS and XHTML.

Well, I'd never pay money to learn HTML. I'd just view the source code of sites with valid HTML and then see what they have done that I haven't.

I used to just use <br> but it seems that I am meant to put <br />

But apparently I can get my site down to very few errors. I had it down to 23. Almost all of those errors were to do with Google AdSense, CuteNews, Extreme Tracker and some URLs that contained ampersands. I couldn't do anything about those.

Thanks people!
 

bcackerman

New Member
ya, put in a type="text/javascript" in there too just for kicks. also get a copy of dreamweaver or microsoft expression web, itll be mmmuch easier because the programs fix these things for you so you don't have 2302 errors, :D
 
Last edited:
Top