Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML代码不工作_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript HTML代码不工作

Javascript HTML代码不工作,javascript,jquery,html,css,Javascript,Jquery,Html,Css,由于某种原因,此HTML无法工作 <!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"> <head> <meta http-equiv="Content-ty

由于某种原因,此HTML无法工作

<!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">
    <head>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
        <title>Gallery</title>
        <!--
        <link rel="stylesheet" type="text/css" href="gallery.css"/>
        Note: use if stylesheet is separated from main project
        I am embedding the CSS so it is easier to send
        -->
        <!--
        <script type="text/javascript" src="gallery.js"></script>
        Note: use if javascript is separated from main project
        I am embedding the JS so it is easier to send
        -->
        <style>
            /* CSS */
            #topbar {}
            #selection {border: 3pt solid red;}
        </style>
        <script type="text/javascript">
            // Javascript
        </script>
        <!-- JQuery -->
        <script src="http://code.jquery.com/jquery-1.8.1.min.js" type="text/javascript"/>
    </head>
    <body>
        <div id="topbar">
            <table id="selection">
                <tr>
                    <td>Test1</td>
                </tr>
            </table>
        </div>
    </body>
</html>
身体里什么也没出现!我甚至试着把一个随机的贴在里面,里面有一些文字,但没有显示出来。有什么问题吗?

您需要关闭标签。自动关闭标记对元素无效:


哦,我真傻。谢谢当stack overflow允许我时,我会接受答案。“自动关闭标记”是有效的,正如您在文档上使用时所看到的,它们不起作用,它们只是被识别为开始标记,因为XHTML文档实际上是由浏览器中的HTML规则处理的,除非与XML内容类型一起发送,这会使IE窒息。这就是为什么XHTML 1.0中的兼容性指导原则会针对它们提出建议:
<script src="http://code.jquery.com/jquery-1.8.1.min.js" type="text/javascript"></script>