Forum Moderators: open
Anyone know what I am doing wrong?
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>My Title</title>
<meta name="Description" content="widgets">
<meta name="Keywords" content="widgets">
<link rel="stylesheet" type="text/css" href="format.css" />
<script type="text/javascript">
"Script is here"
</script>
</head>
-------------------------
Examples of errors:
Error Line 9 column 58: character data is not allowed here.
<link rel="stylesheet" type="text/css" href="format.css" />
-----------------------------------------
Error Line 51 column 143: there is no attribute "BGCOLOR".
...pmargin="0" bottommargin="0" bgcolor="black">
Is there something that I am missing? This is my first website, lol.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 [b]S[/b]trict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html [b]xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"[/b]>
<head>
[b]<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />[/b]
<title>My Title</title>
<meta name="Description" content="widgets"[b] />[/b]
<meta name="Keywords" content="widgets"[b] />[/b]
<link rel="stylesheet" type="text/css" href="format.css" />
<script type="text/javascript">
"Script is here"
</script>
</head> Corrections are in bold - I have added a meta tag for the character encoding. Unless you encode the page as UTF-8 (which is ideal but very problematic if you are only using Notepad - most proper text editors can do it though) you should change the encoding to the one you are using. On the
html tag, you should change en to the appropriate two-letter language code for your site's language. For the other errors, the attributes
topmargin, leftmargin etc. as well as bgcolor are either invalid or deprecated - you should be using CSS instead. Remove them and add the following to your stylesheet: body {
margin:0;
padding:0;
color:#fff; /* or your text default color */
background:#000;
}
function fFixIE( $str) { // fix IE entity/1252 conversions
$srch=array( "& ", "®", "©", "\x91", "\x92", "\x93", "\x94", "â", "ç", "ê", "ñ", "Ε", "λ", "δ", "α" );
$repl=array( "& ", "®", "©", "‘", "’", "“", "”", "â", "ç", "ê", "ñ", "Ε", "λ", "δ", "α" );
return str_replace( $srch, $repl, $str);
}
(Windows "smart quotes" and their entity equivalents are emboldened.)
Essentially, Windows uses (both) 8-bit and 16-bit Unicode at the kernel & API-level. Various MS apps (such as Word) will change quoted words to "smart quoted" words. That means that
"smart quoted"will become
\x93smart quoted\x94(or at least, that is what the research on my own site showed).
The above is not, in itself, a problem, but the issue of the character encoding *is* a problem. If either the server or the HTML declares your document to be UTF-8, but the document contains Windows "smart quotes" (which are "windows-1252" encoding) then it will fail validation.
A bit clearer?
=================================
validator.w3.org/
This page is not Valid (no Doctype found)!
Below are the results of attempting to parse this document with an SGML parser.
Error Line 1 column 0: no document type declaration; implying "<!DOCTYPE HTML SYSTEM>".
<HTML><HEAD><META HTTP-EQUIV="Refresh" CONTENT="0.1; URL=/">
The checked page did not contain a document type ("DOCTYPE") declaration. The Validator has tried to validate with a fallback DTD, but this is quite likely to be incorrect and will generate a large number of incorrect error messages. It is highly recommended that you insert the proper DOCTYPE declaration in your document -- instructions for doing this are given above -- and it is necessary to have this declaration before the page can be declared to be valid.
✉
Error Line 4 column 6: end tag for "HEAD" which is not finished.
</HEAD></HTML>
Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>
Another possibility is that you used an element which requires a child element that you did not include. Hence the parent element is "not finished", not complete. For instance, <head> generally requires a <title>, lists (ul, ol, dl) require list items (li, or dt, dd), and so on.
✉
Error Line 4 column 13: end tag for "HTML" which is not finished.
</HEAD></HTML>
===========
Here is my script now:
<!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" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Widgets</title>
<meta name="Description" content="Widgets"/>
<meta name="Keywords" content="widgets"/>
<link rel="stylesheet" type="text/css" href="format.css" />
<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 3;
var menuYmin = 75;
var menuYmax = 175;
//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = numofitems;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}
//menu methods
function ehandler(event,theobj){
for (var i=1; i<= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}
function closesubnav(event){
if ((event.clientY <menuYmin)¦¦(event.clientY > menuYmax)){
for (var i=1; i<= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>
</script>
</head>
<body>
my ending tags:
</td>
</body>
</html>
========
Anything I am doing wrong?