Javascript 在ASP中调用HTML以调用其他脚本
我在sharepoint上工作,在我的文件中嵌入了jquery、google图表和Angle库调用。但是,当我需要添加或删除内容时,返回SharePoint designer并编辑母版页会变成一个乏味的过程 这就是我所拥有的:Javascript 在ASP中调用HTML以调用其他脚本,javascript,html,asp.net,sharepoint,Javascript,Html,Asp.net,Sharepoint,我在sharepoint上工作,在我的文件中嵌入了jquery、google图表和Angle库调用。但是,当我需要添加或删除内容时,返回SharePoint designer并编辑母版页会变成一个乏味的过程 这就是我所拥有的: <asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobaliz
<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true">
<Scripts>
<%-- Libraries/Addons Nov27/13 --%><asp:ScriptReference Path="/Style Library/libs/jquery-1.10.2.min.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/libs/jquery-ui.min.js"></asp:ScriptReference>
<asp:ScriptReference Path="https://www.google.com/jsapi"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/libs/jquery.SPServices-2013.01.min.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/libs/angular.min.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/libs/knockout-3.0.0.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/addons/wpToggle/wpToggle-jQuery.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/addons/spCharts/spjs-charts-v4.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/addons/quickLaunchToggle/jQuery.LISP.quicklaunch.js"></asp:ScriptReference>
</Scripts>
</asp:ScriptManager>
我正在尝试替换这个文件,取而代之的是一个html文件(或者任何允许它工作的文件),并对该文件进行调用。
例如,如果我有一个包含以下内容的html文件:
<html>
<head>
<title>Script Controller File</title>
<script type="text/javscript" src="/script1.js"></script>
<script type="text/javscript" src="/script2.js"></script>
<script type="text/javscript" src="/script3.js"></script>
<link href="style1.css" type="text/css" rel="stylesheet" />
<link href="style2.css" type="text/css" rel="stylesheet" />
<link href="style3.css" type="text/css" rel="stylesheet" />
</head>
</html>
脚本控制器文件
我可以在sharepoint中更改此设置:
<asp:ScriptManager id="ScriptManager" runat="server" EnablePageMethods="false" EnablePartialRendering="true" EnableScriptGlobalization="false" EnableScriptLocalization="true">
<Scripts>
something something call Script Controller File
</Scripts>
</asp:ScriptManager>
脚本控制器文件
这样,我就不必总是担心编辑SharePoint页面以包含我想要的脚本,而只需要编辑脚本控制器文件。这可能吗 看起来是LABjs的完美使用:() 包含一个Javascript文件以及传递给LABjs的其他必需脚本。LAB将异步/同步加载它们,并将它们添加到页面标题 脚本管理器
<Scripts>
<asp:ScriptReference Path="/Style Library/libs/LAB.min.js"></asp:ScriptReference>
<asp:ScriptReference Path="/Style Library/libs/scriptLoader.js"></asp:ScriptReference>
</Scripts>
我不能100%确定哪些脚本需要同步加载。wait()告诉实验室在加载并包含之前的所有内容之前,不要再发出任何脚本请求。您可能需要检查:
这是一种新的方式(对于不受支持的浏览器使用polyfill),允许调用包含所有资源的单个HTML文件。看起来是一个完美的解决方案。我要试一试。谢谢
$LAB
.script("/Style Library/libs/jquery-1.10.2.min.js").wait()
.script("/Style Library/libs/jquery-ui.min.js")
.script("https://www.google.com/jsapi").wait()
.script("/Style Library/libs/jquery.SPServices-2013.01.min.js")
.script("/Style Library/libs/angular.min.js").wait()
.script("/Style Library/libs/knockout-3.0.0.js")
.script("/Style Library/addons/wpToggle/wpToggle-jQuery.js")
.script("/Style Library/addons/spCharts/spjs-charts-v4.js")
.script("/Style Library/addons/quickLaunchToggle/jQuery.LISP.quicklaunch.js").wait();