ajax下的javascript
2009-05-21 18:33
232 查看
例1、
如果你用的是微软的ajax框架,弹出提示框应该用:
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,账号和密码错误');", true);
例2、
protected void LinkButton_DocName_Command(object sender, CommandEventArgs e)//查看文献详情
{
string docID = e.CommandArgument.ToString();
string key = "js";
string javascript = " <script>window.open('DocumentDetail.aspx?docID=" + docID + "','_blank','height=300, width=820,toolbar=no,scrollbars=yes, resizable=yes') </script>";
ScriptManager.RegisterStartupScript(GridView1, GridView1.GetType(), key, javascript, false);
}
P.S.
public static void OpenerReload(Page page, string key)
{
Type cstype = page.GetType();
ClientScriptManager cs = page.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, key))
{
String cstext = "window.opener.window.document.forms(0).submit();window.opener.location.href=window.opener.location.href;";//window.opener.location.reload();";
cs.RegisterStartupScript(cstype, key, cstext, true);
}
}
//我恨ajax!
如果你用的是微软的ajax框架,弹出提示框应该用:
ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('对不起,账号和密码错误');", true);
例2、
protected void LinkButton_DocName_Command(object sender, CommandEventArgs e)//查看文献详情
{
string docID = e.CommandArgument.ToString();
string key = "js";
string javascript = " <script>window.open('DocumentDetail.aspx?docID=" + docID + "','_blank','height=300, width=820,toolbar=no,scrollbars=yes, resizable=yes') </script>";
ScriptManager.RegisterStartupScript(GridView1, GridView1.GetType(), key, javascript, false);
}
P.S.
public static void OpenerReload(Page page, string key)
{
Type cstype = page.GetType();
ClientScriptManager cs = page.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, key))
{
String cstext = "window.opener.window.document.forms(0).submit();window.opener.location.href=window.opener.location.href;";//window.opener.location.reload();";
cs.RegisterStartupScript(cstype, key, cstext, true);
}
}
//我恨ajax!
相关文章推荐
- Javascript -- ajax
- HTML+javascript+aspx+c#实现ajax功能
- (IBM)最大限度利用 JavaScript 和 Ajax 性能
- 在JavaScript的jQuery库中操作AJAX的方法讲解
- 10个优秀Javascript、Ajax资源网站
- 最大限度利用 JavaScript 和 Ajax 性能
- AJAX 中的javascript部分
- javascript 进阶篇3 Ajax 、JSON、 Prototype
- Javascript 基础---Ajax入门必看
- javascript 进阶篇3 Ajax 、JSON、 Prototype介绍
- JQuery/AjaX/Javascript/DIV+CSS资源下载地址
- javascript结合ajax读取txt文件内容
- JavaScript之Ajax-4 XML解析(JavaScript中的XML、Ajax返回并解析XML)
- [JavaScript][AJAX]封装好的AJAX工具类
- javascript中ajax的使用
- javascript:同时使用form表单还有ajax会怎么样?
- JavaScript学习——Ajax
- JavaScript,JQuery,Ajax常见问题总结
- AJAX--异步JavaScript和xml
- javascript 利用ajax读取json数据