0

W3C 验证器和我的 Firefox 源代码浏览器都在抱怨停留<head>标签。页面本身显示正常。下面是我的 php 脚本生成的部分 html 代码。

<!DOCTYPE HTML>
<html>
<!--scripts/head.php-->
<!--
Copyright (c) 2012 Studiopatty
-->
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <title>Studio Patty: Kapster en Buikdanseres - Kapster</title>
    <meta name="keywords" content="Patty studiopatty dansschool buikdansschool kapster buikdansen buikdanstheater oervrouwen Rozenburg Voorne-putten">
    <link rel="stylesheet" href="css/fonts.css?20121212" type="text/css"/>
    <link class="cssfx" rel="stylesheet" href="css/table.css?20121212" type="text/css"/>
    <link class="cssfx" rel="stylesheet" href="css/main.css?20121212" type="text/css"/>
    <script src="scripts/cssfx.min.js"></script>
    <link rel="shortcut icon" href="images/tattoo.ico">

</head>
<body>
<!--scripts/navigation.php-->
<div id="sidebar">
<a class="logo" href="index.php"></a>

<ul class="nav">
    <li><a class="nav" id="upper" title="Over mijn kapsalon" href="kapster.php">Kapster</a></li>
    <li><a class="nav" title="Algemeen" href="buikdanseres.php">Buikdanseres</a></li>
    <li><a class="nav" title="Mijn ervaring met buikdansen" href="over.php">Over Patty</a></li>
    <li><a class="nav" title="Informatie over lessen die ik geef" href="lessen.php">Lessen</a></li>
    <li><a class="nav" title="Het buikdantheater" href="buikdanstheater.php">Buikdanstheater</a></li>
    <li><a class="nav" title="Agenda" href="evenementen.php">Evenementen</a></li>
    <li><a class="nav" title="Videos van projecten, optredens en lessen" href="media.php">Beeld en geluid</a></li>
    <li><a class="nav" title="Contact" href="contact.php">Contact</a></li>
    <li><a class="nav" id="down" title="Links naar andere webpagina's" href="links.php">Vrienden</a></li>
</ul>
<footer><p class="center footer"><a href="copyright.php">&copy Copyright 2012 - Patty Willemsen<br>
and others</a></p></footer>
</div><!--scripts/foto.php-->
<script>
var pic_array=new Array("foto/Patty.jpg", "foto/IMG_5635.jpg", "foto/DSCN0889.jpg", "foto/Buikdanslesgroep_073.JPG", "foto/385079_270974476272094_100000786300365_743607_1443696752_n.jpg", "foto/863234958_5_nK1e.jpg", "foto/374577_270974419605433_100000786300365_743605_1359936845_n.jpg");
var num_pics=7;
var current_pic=0;
var picTimer;

function timePictures()
{ picTimer=setTimeout("nextPicture()", 10000); }

function nextPicture()
{ current_pic++; if(current_pic>=num_pics) current_pic=0;
document.getElementById("NewPic").src=pic_array[current_pic]; }

</script>

<div class="slideshow">
<img id="NewPic" src="foto/Patty.jpg" alt="test" onload="timePictures();"/>
</div>

<div id="text">
<div class="banner"></div>

<!--content/kapster_text.php-->
<h2>Heren-en Dameskapster<br>"Patty"</h2>

<table class="nice" border="0">
<tr><th rowspan="3">Werktijden:</th><td class="middle">maandag </td><td>13.00 - 20.00 uur</td></tr>
<tr>                                                <td class="middle">dinsdag </td><td>09.30 - 16.30 uur</td></tr>
<tr>                                                <td class="middle">donderdag </td><td>09.30 - 16.30 uur</td></tr>
</table>

<p class="nice"><b>Behandeling op afspraak.</b> <br>
Elzenlaan 15 <br> 
3181 BG Rozenburg <br>
0181-213372 / 06-12896620 </p>

<p class="center">
Graag wil ik je uitnodigen voor prachtig haar
</p>
<div class="banner"></div>
</div> <!--div id="text"-->

</body>
</html>
4

1 回答 1

2

<head>我用谷歌搜索了实际的网页,问题是标签前第二条评论之前的单个不可见字符。

<!--scripts/head.php-->
 <!--
^
HERE IS AN INVALID CHARACTER

Copyright (c) 2012 Studiopatty
-->

该字符导致验证器认为<head>已经隐式启动并抱怨实际<head>标签。

如果您使用 ctrl 或 alt 等修饰符按空格键,某些编辑器允许您添加不可见的绑定字符,这很容易导致这种情况。

于 2013-03-23T14:35:17.843 回答