JS文件未显示在localhost默认页面之后

JS files not being displayed past localhost default page

本文关键字:默认 之后 localhost 文件 显示 JS      更新时间:2023-11-08

这是我在任何地方的第一篇论坛帖子,请耐心等待。我正试图通过MVC(终极版的最新版本)在我的web应用程序中使用来自metro.ui.org的bootsrap文件,并且我在html共享布局中包含的任何js文件都只显示在弹出的第一个页面(localhost)上。每当我链接出第一个页面并转到该网站的任何其他页面时,它都会显示site.css默认文件,而不是我一直使用的自定义js文件。

我尝试过使用metro引导程序中的html操作链接和按钮。我也在chrome、internet explorer 10和firefox中运行过它,但没有任何帮助。我诅咒HTML5文档类型(metro引导程序所必需的)。

第一张图片是当我离开默认页面时,顶部的按钮一直在做的事情。第二个图像是所有引导文件使用的第一个页面(只有localhost)。

https://i.stack.imgur.com/EreqD.jpg

哇,你们的反应真快!这是我的共享布局代码。我只是在学习如何使用所有这些,所以它有点乱。下面的前两个按钮我尝试使用动作链接,但似乎没有任何帮助。

<!DOCTYPE HTML5>
<html lang="en">
    <head>
        <link rel="stylesheet" href="css/metro-bootstrap.css">
        <script src="js/jquery/jquery.min.js"></script>
        <script src="js/jquery/jquery.widget.min.js"></script>
        <script src="js/metro/metro-*.js"></script>
        <meta charset="utf-8" />
        <title>@ViewBag.Title - LangPract</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
        @Styles.Render("~/Content/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    <body class="metro">
        <header >
            <div id="menu" style="background-color:rgb(51, 51, 51); padding-left: 1%; 
                        height: 115px;width:64%;float:left">
                @Html.ActionLink("LangPract", "Index", "Home")
                <br/>
                @ViewBag.render
                <h8>@ViewBag.Title.</h8>
                <h4>@ViewBag.Message</h4>
            </div>
            <div id="content" style="background-color:rgb(51, 51, 51);  height:115px; 
                        width:35%; float:right">
                <button class="image-button primary">
                        @Html.ActionLink("Home", "Index", "Home")
                    <i class="icon-home bg-cobalt"></i>                            
                </button>                      
                <button class="image-button primary">
                        @Html.ActionLink("About", "About", "Home")
                    <i class="icon-info-2 bg-cobalt"></i>
                </button>               
                <br />                 
                <a href="~/Home/Contact">   
                    <button class="image-button primary">
                        Contact
                        <i class="icon-phone bg-cobalt"></i>
                    </button>
                </a>
                <a href="~/Profile/Student">    
                    <button class="image-button primary">
                        Profile
                        <i class="icon-user bg-cobalt"></i>                            
                    </button>
                </a>
            </div>
        </header>
        <div id="body">
            <hr>
                @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            <hr>
            <div class="content-wrapper">
                <div class="float-left, float-top">
                    <p style="padding-left: 4px;">&copy; @DateTime.Now.Year - LangPract</p>
                </div>
            </div>
        </footer>
        @Scripts.Render("~/bundles/jquery")
        @RenderSection("scripts", required: false)
    </body>
</html>

联系人页面有contact.html页面吗?如果是这样的话,你可能只链接了index.html头中的metro-bootstrap.css文件——这将导致css只在最初的index.html页面上生效,而不是在你的联系人页面上生效。

在想要样式在其中生效的任何html页面的<head></head>中添加<style type="text/css" url="metro-bootstrap-.css"></style>

我还应该澄清,HTML5 doctype只是浏览器在渲染html和css时了解您使用的标准版本的一种方式。这个http://metroui.org.ua/该网站要求您的页面拥有它,因为它是最新的,并且可以很好地与今天正在构建的所有内容配合使用。

请参阅http://alistapart.com/article/doctype有关什么是doctype的更多详细信息。