欢迎来到天天文库
浏览记录
ID:35318589
大小:50.00 KB
页数:12页
时间:2019-03-23
《javascript常用技巧汇总》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、JavaScript常用技巧汇总(一).确认删除用法: 1.BtnDel.Attributes.Add("onclick","returnconfirm('"+"确认删除?"+"')"); 2.linktempDelete.Attributes["onclick"]="javascript:return confirm('"+"确认删除?"+"');"; 3.privatevoidgrdProject_ItemDataBound(objectsender,DataGridItemEventArgse) 4. {if((e.Item.ItemT
2、ype==ListItemType.Item)
3、(e.Item.ItemType==ListItemType.AlternatingItem)){ //刪除按鈕上的提示部分 e.Item.Cells[10].Attributes.Add("onclick","returnconfirm('确定删除吗?');");} } 5. functiondelete_y(e) { if(event.srcElement.outerText==
4、"删除") event.returnValue=confirm("确定删除?");}document.onclick=delete_y; (二).跨语言字符串替换 System.Text.RegularExpressions.Regex.Replace(str1,@"<{1}[^<>]*>{1}","").Replace(" ","").Replace("\","\").Replace("-","-").Replace("&","&").Replace("<","<")
5、.Replace(">",">").Replace("br","");(三).关闭窗体 1. this.btnClose.Attributes.Add("onclick", "window.close();returnfalse;"); 2.关闭本窗体间跳转到另一个页面 this.HyperLink1.NavigateUrl="javascript:onclick=window.opener.location.assign ('"+"index.aspx"+"?&Func=Edit&AutoID="+intAutoid
6、+');window.close();"; 3.关闭父窗体: 'onclick="window.parent.close()" Class="Button"> 4.关闭本弹出窗体,并刷新父页面 this.Response.Write("window.opener.location.reload();window.close();");(四).WebMessageBox 1.
7、 Response.Write("window.alert('保存成功1');"); 2. Response.Write(""); 3. this.Page.RegisterStartupScript("ChiName","alert('"+"保存成功!"+"')");(五).DataGrid中加CheckBox
8、控件模板列. 请看: http://blog.csdn.net/chengking/archive/2005/10/08/497520.aspx(六).window.open()方法语法:window.open(pageurl,name,parameters);window对象的open()方法用于创建一个新的窗口实例,新创建的窗口的外观由参数:parameters指定。新窗口中打开的文档由参数: pageurl指定。系统能够根据参数:name确定的名称访问该窗口。 下表为parameters参数表: 参数 衩始值
9、 说明 alwaysLoweredyes/no指定窗口隐藏在所有窗口之下。 alwaysRaisedyes/no指定窗口浮在所有窗口之上。
此文档下载收益归作者所有