摘要: 异步加载JS的五种方式(详解)方案一:<script>标签的async="async"属性(详细参见:script标签的async属性)点评:HTML5中新增的属性,Chrome、FF、IE9&IE9+均支持(IE6~8不支持)。此外,这种方法不能保证脚本按顺序执行。方案二:<script>标签的defer="defer"属性点评:兼容所有浏览器。此外,这种方法可以确保所有设置defer属性的脚本按顺序执行。方案三:动态创建<script>标签示例:<!DOCTYPEhtml><html> 阅读全文
posted @ 2012-08-07 14:51 slc 阅读(697) 评论(0) 推荐(0) 编辑
摘要: Repeater嵌套Repeater的结构:一般写过的都能看懂吧cs代码:private void RpTypeBind() {//GetQuestionTypeAndCount() 返回一个datatable this.rptypelist.DataSource = LiftQuestionCtr.GetQuestionTypeAndCount(); this.rptypelist.DataBind(); } protected void rptypeli... 阅读全文
posted @ 2012-07-19 17:57 slc 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1.上传图片前台:form中加入 enctype="multipart/form-data"。一般处理事件中 context.Request.ContentType = "text/html";案例: HttpFileCollection files = HttpContext.Current.Request.Files; if (files.Count > 0) { for (int i = 0; i < files.Count; i++) { Htt... 阅读全文
posted @ 2012-07-17 10:46 slc 阅读(208) 评论(0) 推荐(0) 编辑
摘要: Excel1.导出excel出现数字过长导致科学计数法出现E字:解决方案:使用vnd.ms-excel.numberformat:@将数字转换为文本 案例: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int count = GridView1.Columns.Count; for (int i ... 阅读全文
posted @ 2012-07-17 10:09 slc 阅读(221) 评论(0) 推荐(0) 编辑
摘要: Injection sql语句全部使用参数形式调用,不拼sql语句 对输入都要验证:客户端验证+服务器段验证 数据库操作的授权 针对每个输入Field,来验证字符串是否允许输入Cross-Site Scripting (XSS) 输入参数,使用微软的Anti-XSS组件过滤 输出到界面html元素’s string,使用微软的Anti-XSS组件过滤 SRE(Security Runtime Engine) HttpModule全自动方式Broken Authentication and Session Management UnknowInsecure Direct Object Refe. 阅读全文
posted @ 2012-06-21 11:18 slc 阅读(249) 评论(0) 推荐(0) 编辑
摘要: protected void Button2_Click(object sender, EventArgs e) { System.IO.StringWriter SW = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter HTW = new System.Web.UI.HtmlTextWriter(SW); Page.EnableViewState = false; Page.Form.Rende... 阅读全文
posted @ 2012-06-20 09:25 slc 阅读(702) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head><title>图片预览</title><script type="text/javascript"> fu 阅读全文
posted @ 2012-05-18 19:32 slc 阅读(1483) 评论(0) 推荐(0) 编辑
摘要: //添加一条薪资情况 function addSalaryTr() { document.getElementById("SalaryTRIndex").value = parseInt(document.getElementById("SalaryTRIndex").value) + 1; //计数 var obj = document.getElementById("SalaryTable"); var newID = parseInt(document.getElementById("Salar... 阅读全文
posted @ 2012-05-16 10:50 slc 阅读(585) 评论(0) 推荐(0) 编辑
摘要: /***************输入一个参数********************/declare @sql Nvarchar(1000)declare @tt intdeclare @t1 intset @t1=55;--set @sql=N' insert into @ab select 2'exec sp_executesql N'select @t2' --执行的语句,若是变量的话,只可以是Nvarchar变量 ,N'@t2 int' --声明执行语句内的参数,若是变量的话,只可以是Nvarchar变量 ,@t2=@t1 --为语句内的 阅读全文
posted @ 2012-04-13 11:22 slc 阅读(1727) 评论(0) 推荐(0) 编辑
摘要: 1 判断数据库是否存在Sql代码 if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名] if exists (select * from sys.databases where name = ’数据库名’) drop database [数据库名]2 判断表是否存在Sql代码 if exists (select * from sysobjects where id = object_id(N’[表名]’) and OBJECTPROPERTY(id, N’IsUserTable’) =. 阅读全文
posted @ 2012-04-13 10:07 slc 阅读(25479) 评论(0) 推荐(6) 编辑