我正在开发一个网络应用。在我的wwwroot目录中,我有一个登录表单目录,其中包含css js和images。在我的布局中,我给了他们一条路。我的目标是加载login.cshtml的图像背景,由script.js更改。你可以看到我在我的布局中路径我的脚本。当我打开我的登录页面时,控制器无法加载图像,我在浏览器中进行了检查。错误是 "无法加载资源:服务器响应状态为404(未找到)" http://localhost:3577/Account/assets/img/backgrounds/3.jpg。有什么不对的我无法解决它?
的script.js
Query(document).ready(function() {
/*
Fullscreen background
*/
$.backstretch([
"assets/img/backgrounds/2.jpg"
, "assets/img/backgrounds/3.jpg"
, "assets/img/backgrounds/1.jpg"
], {duration: 3000, fade: 750});
/*
Form validation
*/
$('.login-form input[type="text"], .login-form input[type="password"], .login-form textarea').on('focus', function() {
$(this).removeClass('input-error');
});
$('.login-form').on('submit', function(e) {
$(this).find('input[type="text"], input[type="password"], textarea').each(function(){
if( $(this).val() == "" ) {
e.preventDefault();
$(this).addClass('input-error');
}
else {
$(this).removeClass('input-error');
}
});
});
});
_layout.cshtml
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<environment names="Development">
<!-- CSS -->
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">
<link rel="stylesheet" href="~/lib/login-form/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="~/lib/login-form/assets/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="~/lib/login-form/assets/css/form-elements.css">
<link rel="stylesheet" href="~/lib/login-form/assets/css/style.css">
</environment>
</head>
<body>
<div>
@RenderBody()
</div>
<environment names="Development">
<!-- Javascript -->
<script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>
<script src="~/lib/login-form/assets/js/jquery-1.11.1.min.js"></script>
<script src="~/lib/login-form/assets/js/jquery.backstretch.min.js"></script>
<script src="~/lib/login-form/assets/bootstrap/js/bootstrap.min.js"></script>
<script src="~/lib/login-form/assets/js/scripts.js"></script>
</environment>
@RenderSection("scripts", required: false)
</body>
</html>