易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript String.replace函数

    javascript的String类内置函数replace(regexp, newString)函数提供了字符串替换功能,从函数原型上可以看出支持 Regular Exp。此函数功能非常实用,但也有几个地方有点混淆,下面通过实际的例子来说明:
    比如我们现在要针对串
var src="<a href=&quot;http://xx.com/a/20100601/000224.htm&quot; target=&quot;_blank&quot;>xxx</a>"
要替换其中的HTML双引号的转移符 &quot; 为实际的 " , 正常我们就会直接调用 src.replace(/&quot;/g, '"');来达到目的,但是js容易让人迷惑的一点就是,这样做并没有实际改变src的值,实际测试发现返回值才是我们需要的结果,而src本身确不发生变化,所以实际中需要通过如下来完成我们的功能:
     src=src.replace(/&quot;/g, '"');


相关文档:

[翻译]High Performance JavaScript(023)

Data Formats  数据格式
    When considering data transmission techniques, you must take into account several factors: feature set, compatibility, performance, and direction (to or from the server). When considering data formats, the only scale you need for comparison is speed.
......

[翻译]High Performance JavaScript(029)

Working Around Caching Issues  关于缓存问题
    Adequate cache control can really enhance the user experience, but it has a downside: when revving up your application, you want to make sure your users get the latest version of the static content. This is accomplished by renaming ......

[翻译]High Performance JavaScript(030)

第十章  Tools  工具
    Having the right software is essential for identifying bottlenecks in both the loading and running of scripts. A number of browser vendors and large-scale websites have shared techniques and tools to help make the Web faster and more efficient. This ......

用JavaScript写的小时候玩的乒乓球小游戏

由于火狐浏览器不支持“removeNode”函数,所以一下代码只支持IE.
<!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>
< ......

Javascript 使用IDE工具进行调试

1. Javascript Debug Toolkit介绍
JSDT(Javascript Debug Toolkit)是一个用于javascript调试的eclipse
插件,用于调试javascript。JSDT可以跨浏览器调试,支持在IE,Firefox,Safari,Chrome等主流浏览器中调试
javascript。JSDT支持设置断点,单步调试等调试工具的基本特性。
2. 如何安装
JSDT是基于eclipse3.2+,jdk1.5+ ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号