私は三つのセクションフォーマットコードセクションのVisual Studio
<script type="text/javascript">
$(document).ready(function() {
if(checkUserHaveMobilePhone) {
@RenderSection("ScriptsPhone", false)
}
else {
@RenderSection("ScriptsPC", false)
}
@RenderSection("Scripts", false)
});
</script>
をプロジェクトASP.NET MVCを持っている私のレイアウトページでのVisual Studio 2017(エンタープライズ版) で、任意のビューで、私は(このコードを持っていますこれは仕事)
<script type="text/javascript">
@section Scripts {
$(window).resize(function() {
});
}
</script>
しかし、私はif文のセクションを追加するとき
動作しません。この後<script type="text/javascript">
@section Scripts {
$(window).resize(function() {
if (parseInt($(window).width()) <= 800) {
alert("Alert");
}
});
}
</script>
私は、 '}' の構文エラー
期待文字を取得
「働かない」とはどういう意味ですか?何か間違いはありますか?期待した結果は何ですか?出力は何ですか? –
'parseInt'の代わりに' parseFloat'を試してください – prasanth
'parseInt'から' parseInt'を変更しても何も与えられていません。このコードは単純なHTMLファイルで動作します – thebox