dongzhuang1923 2016-01-30 18:18
浏览 207
已采纳

这段代码有什么问题,验证?

I have a piece of code which need to be validated for XHTML. I don't find any serious errors, but the w3 validator finds six errors and one warning:

  1. Error: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.) At line 1, column 2 <?php↩ $PROGNAVN

  2. Warning: Comments seen before doctype. Internet Explorer will go into the quirks mode. From line 1, column 1; to line 3, column 2 <?php↩ $PROGNAVN = "Spare Siden &reg;";↩?>↩<!DOC

  3. Error: Saw <?. Probable cause: Attempt to use an XML processing instruction in HTML. (XML processing instructions are not supported in HTML.) At line 11, column 2

    head>↩<body>↩↩<?php↩ echo "<h2

  4. Error: Stray end tag h2. From line 12, column 41; to line 12, column 45

    ROGNAVN ."</h2><br />

  5. Error: Text not allowed in element ol in this context. From line 15, column 12; to line 15, column 13 echo "<ol> ↩ <l Content model for element ol: Zero or more li and script-supporting elements.
  6. Error: Text not allowed in element ol in this context. From line 16, column 56; to line 16, column 57 g</a></li> ↩ <l Content model for element ol: Zero or more li and script-supporting elements.
  7. Error: Text not allowed in element ol in this context. From line 17, column 58; to line 17, column 59 r</a></li> ↩ < Content model for element ol: Zero or more li and script-supporting elements.

Validation picture

  • 写回答

2条回答 默认 最新

  • drduinfu915094 2016-01-30 18:32
    关注

    I agree with Luchiro and rmjoia.

    And to give you a tip, my norwegian mate, I wouldn't echo out that whole block on php. It's simpler, and better to use php within the tags:

    <?php
    $PROGNAVN = 'Spare Siden &reg;';
    ?><!DOCTYPE html>
    <html>
      <head>
        <title><?php echo $PROGNAVN; ?> - Hjemme siden</title>
      </head>
      <body>
        <h2>Velkommen til <?php echo $PROGNAVN; ?></h2>
        <p>Her får du hjelp med din personlige økonomi.</p>
        
        <ol>
          <li><a href="banksparing.php">Banksparing</a></li>
          <li><a href="verdipapirer.php">Verdipapirer</a></li>
        </ol>
      </body>
    </html>

    Let me know if you need a web developer.

    </div>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用