Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net jQuery和ClientScriptManager.RegisterStartupScript_Asp.net_Jquery - Fatal编程技术网

Asp.net jQuery和ClientScriptManager.RegisterStartupScript

Asp.net jQuery和ClientScriptManager.RegisterStartupScript,asp.net,jquery,Asp.net,Jquery,使用asp.net方法ClientScriptManager.RegisterStartupScript包含jQuery脚本是否安全 例如,在页面中: this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test').hide();", true); this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test

使用asp.net方法ClientScriptManager.RegisterStartupScript包含jQuery脚本是否安全

例如,在页面中:

this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test').hide();", true);
this.ClientScript.RegisterStartupScript(typeof(string), "script1", "$('#test').hide();", true);
这会导致任何问题吗


谢谢

是的,它是安全的,因为脚本添加到页面末尾,所以您可以假设您可以在DOM已加载时操作它,而不需要将调用包装在一个文件中。

是的,它是安全的,因为脚本添加到页面末尾,所以您可以假设您可以在DOM已加载时操作它,并且不需要将调用包装在一个中。

应该可以。是的,但是您的脚本将无法工作,因为您错过了语句开头的$


应该可以,是的,但是您的脚本将无法工作,因为您从语句开始就错过了$