在我的剃刀模板中,jquery有一个if else checking.in thet if条件小于或大于符号得到一些错误。
这是我的主人布局
@inherits CompositeC1WebPage
@{
string stylesFolder = "~/Frontend/Styles";
string jsFolder = "~/Frontend/Scripts";
string websiteTitle = HomePageNode.Title;
}
<!DOCTYPE html>
<f:function name="Composite.Web.BundlingAndMinification" xmlns:f="http://www.composite.net/ns/function/1.0">
<f:param name="Page">
<html xmlns="http://www.w3.org/1999/xhtml" class="no-js" lang="@Lang">
<head>
<title>@CurrentPageNode.Title</title>
@if (!string.IsNullOrEmpty(CurrentPageNode.Description))
{
<meta name="description" content="@CurrentPageNode.Description" />
}
@PageTemplateFeature("Descriptive HTML head elements")
</head>
<body>
@RenderBody()
@RenderSection("Scripts", false);
</body>
</html>
</f:param>
</f:function>
和我家的剃刀templte是
@inherits RazorPageTemplate
@functions {
public override void Configure()
{
TemplateId = new Guid("a270f819-0b5c-4f7e-9194-4b554043e4ab");
TemplateTitle = "Home_En";
Layout = "MasterLayout.cshtml";
}
[Placeholder(Id = "content", Title = "Content", IsDefault = true)]
public XhtmlDocument Content { get; set; }
[Placeholder(Id = "aside", Title = "Aside column")]
public XhtmlDocument Aside { get; set; }
}
@{
string stylesFolder = "~/Frontend/Styles";
string jsFolder = "~/Frontend/Scripts";
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
@*you can add template specific head elements here*@
</head>
<body id="page-top" class="index">
<div class="ban_replace">
<img src="/Image/test/banreplace.jpg" alt="" />
</div>
@Html.Raw(Content)
@section Scripts
{
<script>
$(document).ready(function () {
var windowsize = $(window).width();
if (windowsize < 480) {
}
else if (windowsize < 640) {
}
else {
}
});
</script>
<script>$(window).fadeThis();</script>
}
</body>
</html>
但控制台错误显示未捕获的syntaxerror意外令牌 任何一个人都可以解决这个问题 在此先感谢您的帮助。
答案 0 :(得分:0)
Composite C1需要razor函数来生成有效的xhtml标记,换句话说,它是一个有效的xml文档。 您可以尝试以下构造作为解决方法:
<script>
// <!--
.... your code here
// -->
</script>
或
<script>
// <![CDATA[
.... your code here
// ]]>
</script>