1. 网上的一些javascript测试题,看你能对几道题?   http://dmitrysoshnikov.com/ecmascript/the-quiz/ 1. What’s the result of: typeof typeof(null) A) “undefined” B) SyntaxError C)“string” D) “object&rdquo ...

    阅读全文
  2. 随着web应用的流行,人们越来越关心网络安全。学习网络安全,我们必须找到组织(The Open Web Application Security Project (OWASP))。 本文是学习XSS中收集并整理的资料,不断更新中。 什么是XSS? XSS是Cross Site Script的简写,即常说的跨站脚本攻击。 XSS攻击场景 使用 XSS盗取Cookie 使用XSS创建覆盖 使用XSS产生HTTP请求 以交互方式尝试基于DOM的XSS 绕过 ...

    阅读全文
  3. Attributes vs. Properties The difference between attributes and properties can be important in specific situations. Before jQuery 1.6, the .attr() method sometimes took property values into account when retrieving some attributes, which could ca ...

    阅读全文
  4. clientHeight 与  offsetHeight的区别和理解。 clientHeight: =( height + padding Height) Returns the height of the visible area for an object, in pixels. The value contains the height with the padding, but it does not include the scrollBar, border ...

    阅读全文
  5. 问题背景:     1.IE6/7/8支持通过window.event获取对象,通过attachEvent方式添加事件时也支持事件对象作为句柄第一个参数传入 2.Firefox只支持事件对象作为句柄第一个参数传入 3.IE9/Opera/Safari/Chrome两种方式都支持 所以在Firefox中直接引用event会有undefined问题。 为了解决浏览器兼容问题,可以使用下面的方法获取。 var evt = windo ...

    阅读全文
  6. 昨晚fix了本博客一个剪贴复制的问题。 需求:希望在编辑博客时能够直接剪贴复制图片到文本框中,这样可以简单快捷的编写文章。 解决方法:是通过javascript来允许用户来粘贴图片到一个div中,然后再复制到文本框中。在读取event.clipboardData的时候chrome和Firefox出现了不同的行为。原因是firefox在某个版本后并不允许javascript访问剪贴板。 安全问题: 允许浏览器访问剪贴板有一定安全问题,正常浏览器可以设置。IE设置如下: ...

    阅读全文
  7. 编写js时仅通过点击链接仅触发事件而不需要返回值,一般通过这两个方式来实现: 第一种写法: function myJsFunc() { alert("myJsFunc"); } <a href="#" onclick="myJsFunc();">Run JavaScript Code</a> 或第二种写法: function myJsFunc() { ale ...

    阅读全文
  8. 页面出现这个错误:“No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.” 这个原先是源于浏览器的跨域请求安全限制,解决办法可以通过设置请求Data类型jsonp或script来解决。 如: ...

    阅读全文
  9. 画一个简图帮助直观理解Javascript获取屏幕,页面,浏览器的高度的方法: 通过window.screenX, window.screenY来获取浏览器在当前屏幕的坐标。 通过window.innerWidth, window.innerHeigher来获取浏览器当前的宽和高。 通过window.scrollX, window.screenY来获取当前页面的滚动条移动情况。 而再获取当前页面的高度时,为了实现浏览器的兼容性,需要通过下面的方式获取最大值。 ...

    阅读全文
  10. 本文用来收集一些当前流行的JS UI框架以及相关的比较文章。这些比较主要从以下几个方面着手: 浏览器支持(各大浏览器支持的版本) 文件大小 许可证信息 源文件信息 支持的具体特性功能 webSocket Data retrieval数据获取方式的支持(XMLHttpRequest, Server push, other) Drag and Drop 视觉效果(如一些动画,渐变,场景变化效果) Grid Rich Text ed ...

    阅读全文