/身体GT;如何在&lt之前添加脚本codeS;标签ASP.NET [英] How to Add script codes before the </body> tag ASP.NET
问题描述
继承人的问题,
在母版中,谷歌分析code组体年底前粘贴
标记。
In Masterpage, the google analytics code were pasted before the end of body
tag.
在ASPX页面,我需要使用codebehind ClientScript
来生成一个脚本(谷歌的addItem跟踪器)和年底前把它身体
标签,因为这个脚本使用谷歌分析的变量。
In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript
and put it before the end of body
tag, because this script uses the google analytics variables.
我怎样才能做到这一点?
How can i achieve this?
推荐答案
这是不雅的,但简单的方法,如果你能避免使用 ClientScript
,是只坚持文字在你希望你的脚本要呈现的页面,并从codebehind把剧本在那里(即 myLiteral.Text =客户端脚本;
)。
An inelegant but simple approach, if you're able to avoid using ClientScript
, would be to just stick a literal in the page where you want your script to be rendered and put the script in there from your codebehind (i.e. myLiteral.Text = "client script";
).
这篇关于/身体GT;如何在&lt之前添加脚本codeS;标签ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!