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. 常常会有数值字符串转换成数值类型的要求。 Integer.parseInt()的使用 public static int parseInt(String s, int radix) throws NumberFormatException Parses the string argument as a signed integer in the radix specified by the second arg ...

    阅读全文
  4. 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 ...

    阅读全文
  5. 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 ...

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

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

    阅读全文
  8. == 用来测试reference是否相等(whether they are the same object). 是否同一个对象? .equals() 用来测试 value 值是否相等 (whether they are logically "equal"). 是否值相同? 记住下面的几个情况: // These two have the same value(相同值) new String("test").equals(" ...

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

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

    阅读全文