我有一个webform页面,它使用包含多个脚本引用的母版页。对于这个特定的页面,我有两个参考额外的java脚本footable.js和footable.striping.js的项目。 名为calandar1old.aspx的webform位于根目录中,使用这两个脚本文件可以正常运行。我得到了一个响应式网格视图,其中包含交替的行高亮显示。
如果我从根目录创建相同的webform几个目录,页面将加载,但脚本(footable.js和footable.striping.js)不会运行。脚本应创建响应式网格视图和交替行高亮显示。我尝试更改/JML/Infoleague/Calandar1.aspx文件中的路径引用,如下所示:
<asp:ScriptReference Path="js-foo/footable.js" />
<asp:ScriptReference Path="~/jml/infoleague/js-foo/footable.js" />
<asp:ScriptReference Path="./jml/infoleague/js-foo/footable.js" />
<asp:ScriptReference Path="../../js-foo/footable.js" />
以下是主文件中的相关信息:
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="SiteMenuHeader.Master.vb" Inherits="CoWorkerTestJML.SiteMenuHeader" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="SemiColonWeb" />
<!-- ============================================
Stylesheets
============================================= -->
<link href="http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic|Open+Sans:400,300,600,700" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="style.css" type="text/css" />
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="css/retina.css" />
<link rel="stylesheet" href="css/colors.php" type="text/css" />
<link rel="stylesheet" href="css/tipsy.css" type="text/css" />
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="css/font-awesome.css" type="text/css" />
<link rel="stylesheet" href="css/animate.css" type="text/css" />
<link rel="stylesheet" href="css/magnific-popup.css" type="text/css" />
<link rel="stylesheet" href="css/ls/css/layerslider.css" type="text/css" />
<link rel="stylesheet" href="css/responsive.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!--[if lt IE 9]>
<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<!-- ============================================
External JavaScripts
============================================= -->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/greensock.js"></script>
<script type="text/javascript" src="js/plugins.js"></script>
<script type="text/javascript" src="js/layerslider.transitions.js"></script>
<script type="text/javascript" src="js/jquery.layerslider.js"></script>
以下是/JML/Infoleague/Calandar1.aspx文件中的相关信息:
<%@ Page Language="vb" MasterPageFile="~/SiteMenuHeader.Master" AutoEventWireup="false" CodeBehind="Calandar1.aspx.vb" Inherits="CoWorkerTestJML.JML_InfoLeague_Calandar1"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<meta name="viewport" content = "width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" />
<link rel="stylesheet" href="css-foo/footable.core.css" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
<Scripts>
<asp:ScriptReference Path="../../js-foo/footable.js" />
<asp:ScriptReference Path="js-foo/footable.striping.js" />
</Scripts>
我几乎肯定存在路径问题。我错过了什么?
答案 0 :(得分:0)
您可以尝试使用以下路径
<asp:ScriptReference Path="/js-foo/footable.js" />
...所代表的路径来自站点的根目录。 您也可以对每个CSS路径执行相同的操作。