0
訪問ConfigurationManager.AppSettings我有這個JavaScript代碼在aspx文件在Java腳本的
Page.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="server">
----some code----
added after suggestion from Satpal
<script type="text/javascript">
var GAAccountId = '<%=ConfigurationManager.AppSettings["GAAccountId"]%>';
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%--<script type="text/javascript">
debugger;
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<%=ConfigurationManager.AppSettings["GAAccountId"]%>']);
_gaq.push(['_setDomainName', 'auto']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview', '/Register']);
_gaq.push(['_trackPageLoadTime']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>--%>
</asp:Content>
現在我把這個代碼seprate .js文件,幷包含在JavaScript文件的引用。現在我無法訪問它,因爲它是即將到來的"'<%=ConfigurationManager.AppSettings["GAAccountId"]%>']"
如何從中獲得價值。
任何建議如何從它的Java腳本文件中獲取價值 –
全球意味着中的
我在哪裏把這個golabl變量放在aspx文件中 –