繁体   English   中英

为什么我的脚本标签显示在我的身体标签之外?

[英]Why are my script tags rendered outside my body tag?

这是我的nhaml代码

^ var title=""
!!! XML
!!! Strict
%html{xmlns="http://www.w3.org/1999/xhtml"}
  %head
    %title
      Nhaml Master #{title}
      _styles
    %body
  .page      
        %h1 = "hello world"
        _
        _scripts

生成的HTML会这样渲染最后一个标签:

    </div>
  </body>
        <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js" type="text/javascript">
        </script>

</html>

由于_scripts仍处于%body +1的缩进级别,为什么在渲染_scripts之前关闭body?

如果将脚本移到部分脚本上方,是否可以正常工作? 如果是这样,那么可能是部分原因。

   %h1 = "hello world"
    _scripts
    _

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM