ClientScript.RegisterStartupScript() [英] ClientScript.RegisterStartupScript()
问题描述
什么是ClientScript.RegisterStartupScript()和ClientScript.RegisterClientScriptBlock()
What is the difference between ClientScript.RegisterStartupScript() and ClientScript.RegisterClientScriptBlock()
推荐答案
之间的区别ClientScript.RegisterStartupScript()
是传递脚本在启动时自动运行的块。
ClientScript.RegisterStartupScript()
is for passing in a block of script which is automatically run at startup.
ClientScript。的RegisterClientScriptBlock()
仅仅是注册一个通用的方法。
ClientScript.RegisterClientScriptBlock()
is just for registering a general method.
我觉得技术不同的是,启动脚本之前刚<$放在C $ C>< / BODY> ,使其尽快在页面加载后执行
I think the technical difference is that the startup script is placed just before the </body>
so that it is executed as soon as possible after the page is loaded?
我有双重检查这一点,这是就是我说的
I have double checked this and it is is what I said.
的 http://msdn.microsoft.com/en-us/library/asz8zsxy.aspx ClientScript.RegisterStartupScript()
当页面加载完成,但提高了网页的onload事件之前,由的RegisterStartupScript方法添加的脚本块执行。
http://msdn.microsoft.com/en-us/library/asz8zsxy.aspx ClientScript.RegisterStartupScript()
"The script block added by the RegisterStartupScript method executes when the page finishes loading but before the page's OnLoad event is raised."
的 http://msdn.microsoft.com/en-us/library/btf44dc9.aspx ClientScript.RegisterClientScriptBlock()
RegisterClientScriptBlock方法添加了一个脚本块到渲染页面的顶部。
http://msdn.microsoft.com/en-us/library/btf44dc9.aspx ClientScript.RegisterClientScriptBlock()
"The RegisterClientScriptBlock method adds a script block to the top of the rendered page."
这篇关于ClientScript.RegisterStartupScript()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!