ClientScript 执行js


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58

?服务端返回让页面执行js的方法有三种:
1,Response.Write(“<script>alert(‘开头成功’);</script>”);
??? 因是Response,故一般会将js加在<html>标签之前,有时可能会使css不能正确执行
?2,ClientScript.RegisterClientScriptBlock( this.GetType(), “show”, “<script>alert(‘更新成功’);</script>” );
??? 将js加在紧跟着<form>标签出现之后,第一个
?3,ClientScript.RegisterStartupScript(this.GetType(), “show“, “<script>alert(‘最后成功’);</script>”);
将js加在紧跟着</form>标签出现之前,最后一个

RegisterStartupScript第二个形参指定js的关键字,要唯一,若相同,则以第一个为主
注:还可利用ClientScript让页面载入js文件:
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),?”MyScript”,? “MyJavaScriptFile.js”)

ClientQueryString: 得到传来的?之后的参数