tips4
1.两个变量互换值的实现: ============================================ var foo = 1; var bar = 2;
//var temp = foo; //foo = bar; //bar = temp; foo = [bar,bar=foo][0];//可以运用数组来实现;[思路很巧妙,但是性能不一定好。] alert(foo); alert(bar); ============================================ 2.防止SQL注入的一些方法: Any string that is inserted into a page must have the following characters replaced with the corresponding HTML/SGML entities: Convert < into < Convert > into > Convert & into & Convert " into " Convert ' into ' Furthermore,ensure that the attribute value is surrounded by double quotes. detail:http://code.google.com/p/doctype/wiki/ArticleXSSInEventHandlers 可以考虑: 在最开始对用户的输入执行addslashes()函数进行处理。 ====================================================== webservice jsonp: JSONP 即 JSON with Padding是JSON格式的扩展。它要求一些服务器端的代码来检测并处理查询字符串参数。 JSON数据是一种能很方便通过JavaScript解析的结构化数据。如果获取的数据文件存放在远程服务器上(域名不同,也就是跨域获取数据),则需要使用jsonp类型。使用这种类型的话,会创建一个查询字符串参数 callback=? ,这个参数会加在请求的URL后面。服务器端应当在JSON数据前加上回调函数名,以便完成一个有效的JSONP请求。如果要指定回调函数的参数名来取代默认的callback,可以通过设置$.ajax()的jsonp参数。 (详情可以查看jquery手册中jQuery.ajax()的说明.) http://blog.csdn.net/DL88250/archive/2008/08/21/2804559.aspx jquery.DOMWindow.js jquery.easywidget.js (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |