我在 aspx 文件中有这个 javascript 代码
页面.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>
现在我将此代码移动到单独的 .js 文件中,并将引用包含在 javascript 文件中。现在我无法访问它。它即将到来"'<%=ConfigurationManager.AppSettings["GAAccountId"]%>']"
如何从中获取价值。