Javascript
共 12 篇文章
HTML5实践Drag&Drop
互联网技术总是在向强大、便捷发展,怎样使用这些层出不穷的技术来改善我们的既有设计,是很能检验开发人员想象力和创造力的。 一个引子: 因为要搜索电影的字幕,打开了http://www.shooter.cn,发现可以直接拖动文件到搜索栏,这是HTML5支持的功能,用在这里能够很好的提升搜索效率,避免用户手动输入电影名,也能够提升搜索结果的准确度。 有篇文章介绍了Drag&Drop功能,http://javascript.ruanyifeng.com/dom/dragndrop.html,mark一下 1、html元素可拖动 <div draggable="true">Draggable Div<…
2014-07-23 17:17 · Javascript
html5读书笔记
book&code:http://www.minkbooks.com/ 第8章-拖放API 1、7种新的事件:为了得到预期效果,需要停止默认行为 ----src-------- dragstart drag dragend ---dest------ dragenter dragover drop dragleave 2、拖放操作 drop = document.getElementById('dropbox'); drop.addEventListener('dragenter', function(e){ e.preventDefault(); });//大多数元素不支持投放操作,为了在…
2013-08-24 21:23 · web · Javascript
RSA加密安全登录
我们平时做用户登录表单提交,用户名密码都是明文直接POST到后端,这样很容易被别人监听到(如一些收手机端端的流量监测app)。注:包括使用MD5等哈希函数处理后的数据,这里也算做明文(现在MD5爆破网站已经很多了~)。 对安全性要求较高的网站,比如银行和大型企业等都会使用HTTPS对其进行加密通讯。但是由于效率原因,使用HTTPS的代价是及其昂贵的,对于访问量稍大的网站就会造成严重的性能瓶颈。 解决方法一般只能采用专门的SSL硬件加速设备如F5的BIGIP等。所以很多网站选择了模拟SSL的做法,使用RSA来对密码等安全信息进行公钥加密,服务端用私钥解密。通常是对密码进行加密。 参考这篇文字,…
2013-04-20 17:30 · JAVA · web · Javascript
JS-类型转换
Type Conversions :JS in very flexible about the types of values it requres.Table below summarizes how values convert from one type to another in JS.Bold entries in the table highlight conversions that you may find surprising.Empty cells indicates that no conversions is necessary and none is perform…
2013-04-01 23:12 · Javascript
JS-特殊类型
null and undefined :null is a language keyword that evaluates to a special value that is usually used to indicates the absense of a value.null can be thought of as a special object value that indicates 'no object'. console.log(typeof null);//object console.log(typeof undefined);//undefined undefine…
2013-03-25 22:24 · Javascript
JS-Boolean
Boolean Values The following values convert to and therefore work like false: All other values,including all objects(and arrays) convert to and work like true. You can test explicitly to see if a is non-null with an if statement like this if(a!==null)... and you can test to see if a is falsy or tru…
2013-03-21 22:56 · Javascript
JS-字符串
String Literals :enclose the characters of the string within a matched pair of single of double quotes. ECMAScript3,string literals must be written on a single line.In ECMAScript 5,however you can break a string literal across multiple lines by ending each line with a backslash.Neither the backslas…
2013-03-16 20:20 · Javascript
JS-日期类型
Dates and Times: Core JS includes a Date() constructor for creating objects that represent dates and times.These Date objects have methods that provide an API for simple date compulations.
2013-03-16 19:47 · Javascript
JS-数字类型
Integer Literals :base-10 integer literals、base-16 integer literals、base-8 integer literals var a = 23; var b = 0x1A;//hexadecimal var c = 012;//octal console.log('a=' + a + ',b=' + b + ',c=' +c ); //a=10,b=26,c=10 Since some implementations support octal literals and some don't , you should never …
2013-03-14 23:53 · Javascript
WEB实战:Ajax上传文件
1)uploadify插件:http://www.uploadify.com/demos/ 2)ajaxfileupload:http://www.phpletter.com/Demo/AjaxFileUpload-Demo/
2013-02-06 20:47 · JAVA · J2EE · web · Javascript
WEB实战:头像裁剪
头像截图在sns的网站用到的非常多,一般分为以下几步来实现这样的功能 1)上传图片,保存到图片服务器(tfs) 2)前台js计算截图区域的坐标、宽、高,将数据提交后台 3)后台java按坐标处理原始图片,再将截取后的图片保存到图片服务器(tfs) 先看看Jcrop截图的效果,它是jQuery的一个插件 参考http://deepliquid.com/projects/Jcrop/demos.php?demo=handler,代码如下: var showCoords = function(c){ $('#x').val(c.x); $('#y').val(c.y); $('#w').val(c…
2013-02-06 12:29 · JAVA · J2EE · web · Javascript