W3C home > Mailing lists > Public > www-validator@w3.org > April 2007

Validator treats javascript as if it were HTML when <!-- //--> is missing.

From: Mark Pawelek <MarkP@mandatewire.com>
Date: Mon, 2 Apr 2007 14:11:14 +0100
Message-ID: <000201c77528$64efd790$3201a8c0@MWDEVELOP>
To: <www-validator@w3.org>

The first error I get in my page is this:

1. Warning Line 34 column 17: character "<" is the first character of a 
delimiter but occurred as data.

  for(var i=0; i < aMenu.length; i++)

I fixed the problem by using the <!--  //--> javascript fix but shouldn't 
the parser give me a more sensible error message?

Here is my page prior to the body tag (after I fixed it by including <!--  
//--> ):

<!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">
<head>
<title>Mandatewire News</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="images/news2.css" type="text/css" rel="stylesheet" />
<script type="text/JavaScript" src='../javascript/browser.js'></script>
<script type="text/JavaScript" src='../javascript/minmax.js'></script>
<script type="text/JavaScript" src='../javascript/mandatexml.js'></script>
<script type="text/JavaScript" src='../javascript/news.js'></script>
<script type="text/JavaScript">
<!--
function MenuButtonIn(oMenuButton){
  oMenuButton.style.backgroundImage = 'url(images/MenuSlice2.gif)';
}
function MenuButtonOut(oMenuButton){
  oMenuButton.style.backgroundImage = 'url(images/MenuSlice1.gif)';
}
function init(){
  showMandate(4707, true);
  FixMenu();
// Ticker Tape
// regenerate2();
// update()
}
function FixMenu()
{
  var aMenu = 
['cmdSearch','cmdMandatewatch','cmdDealFlow','cmd4Week','cmd2Week','cmd1Week'];
  for(var i=0; i<aMenu.length; i++)
    MenuButtonOut(document.getElementById(aMenu[i]));
  return;
}
window.onload = init;
//-->
</script>
</head> 
Received on Monday, 2 April 2007 19:29:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:24 GMT