ASPX直接编写脚本function后使用javascript
来源:互联网 发布:电脑小音箱 知乎 编辑:程序博客网 时间:2024/06/05 10:57
RegisterClientScriptBlock
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
Title :RegisterClientScriptBlock block与Cs中直接编写脚本function后使用javascript
Description:
version : 1.0 Date :8:46 2008-3-26
Author : TianzhenYu/田振宇/Nick(Tim) Contact :MSN:zhenyu_tian@hotmail.com
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
//★★★①步骤:
//Create defalut.apx /MasterPage.master
//defalut.aspx 删除From etc Code...
//Edit MasterPage.master PreRender1()
//★★★②代码分析:
protected void ContentPlaceHolder1_PreRender1(object sender, EventArgs e)
{
LoadScript1();
}
private void LoadScript1()
{
ClientScriptManager scriptmanager=Page.ClientScript;
StringBuilder sb = new StringBuilder();
sb.Append("<script language=javascript>");
sb.Append("function changecolor(color){");
sb.Append("document.bgColor=color"); //注意脚本语句的语法,否则全完蛋...
sb.Append("}");
sb.Append("</script>");
if (!scriptmanager.IsClientScriptBlockRegistered("changecolor"))
{
scriptmanager.RegisterClientScriptBlock(this.GetType(), "changecolor", sb.ToString());
}
}
//★前台代码: 这不是服务端控件,所以不需要ruant=server
<div><input type=button id=btnchangecolor value=changecolor onclick="changecolor('gree');" /></div>
//★★★
/*─────────────────────────────────────────────────
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
//提示:
//☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
─────────────────────────────────────────────────*/
//㈠ ㈡ ㈢ ㈣ ㈤ ㈥ ㈦ ㈧ ㈨ ㈩
//⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾ ⑿ ⒀ ⒁ ⒂ ⒃ ⒄ ⒅ ⒆ ⒇
//① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩
//─────────────────────────────────────────────────
- ASPX直接编写脚本function后使用javascript
- Aspx页面中直接编写javascript脚本
- javascript函数直接量(function(){})()
- VS2005如何调试aspx中JavaScript脚本
- 文档显示部件直接使用javascript脚本介绍
- JavaScript编写浏览器脚本
- 浅谈JavaScript脚本编写规范
- shell脚本编写使用
- Javascript Object与Function使用
- VS2005编写aspx,设计 不能使用的解决方法
- 使用javascript编写特效
- Photoshop脚本 > 使用ExtendScript编写Ps脚本
- 使用java编写monkeyrunner脚本
- 使用记事本编写Ps脚本
- 使用shell脚本编写cgi
- shell 脚本之 Function 功能的使用
- javascript: 脚本编写的一点细节
- 如何在UltraEdit中编写javascript脚本
- hadoop io Sequence, Map, Set, Array, BloomMap Files(译文)
- 母版事件中注册javascript脚本
- ASP.NET页面注册Javascript脚本
- ASP.NET页面注册Javascript脚本
- Aspx页面中直接编写javascript脚本
- ASPX直接编写脚本function后使用javascript
- fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
- 关于Onsize中控件句柄为空的问题
- postgresql 导入sql文件
- ARM指令 LDR r,=imd
- android 常用语句收集
- MySQL Cluster(MySQL集群)配置生成器(MySQL实验室提供)
- css中font-family为中文时带来的问题
- 6)MSP430的比较器A