使用asp.net方法ClientScriptManager.RegisterStartupScript包含jQuery脚本安全吗?
http://msdn.microsoft.com/en-us/library/z9h4dk8y.aspx
作为页面中的示例:
this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test').hide();", true);这会导致任何问题吗?
谢谢
发布于 2010-07-15 15:53:47
是的,它是安全的,因为脚本被添加到页面的末尾,所以您可以假设您可以操作DOM,因为它已经加载,并且您不需要将调用包装在$(document).ready中。
发布于 2010-07-15 15:54:02
这应该是好的,是的,但是你的脚本不会工作,因为你从语句的开头遗漏了$。
this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test').hide();", true);https://stackoverflow.com/questions/3253488
复制相似问题