我的asp.net页面上有一个Javascript块:
<script type="text/javascript">
Sys.debug = true;
var popup;
Sys.require(Sys.components.popup, function () {
popup = Sys.create.popup("#popup", {
parentElementID: "target",
});
});
</script>
如何从C#代码后面调用它?
ClientScript.RegisterStartupScript(GetType(), "key", ???, true);
答案 0 :(得分:0)
您可以在MSDN上找到有关此问题的帮助:http://social.msdn.microsoft.com/Forums/vstudio/en-US/a5f09794-3224-4c9d-8453-688a303a9198/call-javascript-function-from-c-codebehind
答案 1 :(得分:0)
试试这个:
ClientScript.RegisterStartupScript(this.GetType(), "sample", "<script
type="text/javascript">Sys.debug = true;var popup;Sys.require(Sys.components.popup,
function () {popup = Sys.create.popup("#popup", {parentElementID: "target",});});
</script>",false);
答案 2 :(得分:0)
一种致电方式:
Page.ClientScript.RegisterStartupScript(this.GetType(),“key”,“xyz();”,true); 将JavaScript保存在一个函数中;