Markup: Why won't my code validate?

started by David on May 14, 2005 — RSS Feed

David David
Posts: 40

Hi guys, I'm having a problem validating a local page. It's just the single error that I get:

Line 70, column 6: end tag for "HEAD" which is not finished


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 (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.

I checked my tags and they seem to be in order. Any ideas? There's rather a lot of javascript, I'm afraid, but I thought I should include it since I think the problem might be in there.

<head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <link rel="stylesheet" type="text/css" href="style.css">
 <style type="text/css">
   li#win1, #win2, #win3 {
     visibility: hidden
   }
   
   a#linkto3, #backonestep {
     visibility: hidden
   }
   
   a#revealmore2, #backtointro {
     visibility: visible
   }
   
   img#imgwin2 {
     visibility: hidden;
     right: 100px;
     top: 30px
   }
 </style>
 <script type="application/x-javascript">
     <!--

     
   function nextslide(slide) {
     if(document.getElementById) {
       for(i=2;i<5;i++) {
         document.getElementById("s"+i).style.visibility="hidden";
       }
       document.getElementById("s"+slide).style.visibility="visible";
     }
   }
   
   var n=1
   
   function revealmore() {
     //show 1st, 2nd and 3rd list items and reveal corresponding pictures
     if(document.getElementById) {
       document.getElementById("win"+n).style.visibility="visible";
       document.getElementById("imgwin"+n).style.visibility="visible";
       if(n==1) {
         document.getElementById("backonestep".style.visibility="visible";
         document.getElementById("backtointro".style.visiblity="hidden";
       }
       n+=1;
       if(n==4) {
         document.getElementById("revealmore2".style.visibility="hidden";
         document.getElementById("linkto3".style.visibility="visible";
       }
     }
   }
   
   function revealless() {
     if(document.getElementById) {
       n-=1;
       if(n==0) {
         replace("gimpUI.html"
       }
       else {  
         document.getElementById("win"+n).style.visibility="hidden";
       }
     }
   }
     -->
 </script>
</head>

Joe Gillespie Joe Gillespie
Posts: 528

Make sure your Javascript statements are teminated properly!

eg

var n=1;

David David
Posts: 40

I thought you only needed to terminate statements in javascript when there's more than one. Anyway, it turns out it's nothing to do with the js anyway. I think it might be something to do with how I've got my style sheets lined up, but I'm not too sure. I still can't validate, either way.  :

Joe Gillespie Joe Gillespie
Posts: 528

No, every Javascript line should be terminated with a semi-colon. You are confusing it with CSS which doesn't need a semi-colon for a single statement.

The missing semi-colon(s) can confuse the validator. You can use Firefox/Mozilla's Javascript console to validate Javascript.

I find that it helps a lot to line up the opening and closing brackets. IT makes the JS code a lot easier to follow.

You don't seem to have a DocType to validate against.

David David
Posts: 40

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
</body>
</html>

This code produces the same error.

Joe Gillespie Joe Gillespie
Posts: 528

Try adding...
<title>A title</title>

Baxter Baxter
Posts: 157

I've foudn I need to wrap my js in cdata tags to make everything happy.

David David
Posts: 40

Forum said:
Try adding...
<title>A title</title>

That did the trick! I didn't realise that titles are mandatory. Thanks for the help guys.

Maskodok Eko Maskodok Eko
Posts: 171

TOP SEO | Jasa SEO Profesional

TOP SEO | Jasa SEO Profesional RajaPoker88.com Agen Texas Poker Dan Domino Online Indonesia Terpercaya IDRPoker.COM Agen Texas Poker dan Domino Online Indonesia Terpercaya POKERSTAR88.com Agen Texas Poker Dan Domino Online Indonesia Terpercaya D

Kokokmas Kokokma Kokokmas Kokokma
Posts: 104

You know, Sim City Societies had a lot of potential, it was a great concept that was horribly developed and lacked any kind of depth. The idea of individualize buildings functioning independently playing its role in a largely diverse and thriving city.

The new Sim City appears to be the classic Sim City gameplay we saw with SC4, combined with a far better developed version of the Societies concepts. Looking great guys, don't let us down.


You must login to reply