看到:王建硕: AJAX - 老酒有了新瓶子,立刻涂鸦了两下,
。也想到了我去年用过的在线即使贴http://www.aypwip.org/webnote/chedong。
当时还没有AJAX这么一个又好记又形象的名字:
App + JAvascript + Xml via http
算是一个巧妙的技术组合吧: 好比是用你用awk + perl形成一套工具箱一样。
escape() & encodeURI() & encodeURIComponent()这三个函数都可以用来对URI进行encode或过滤特殊字符(#/$&+=?/等)。我的经验是最好用encodeURIComponent()(需要IE 5.5以上,FireFox当然没问题),因为对UTF-8支持比较好,不会遇到中文乱码问题,否则还需要进行编码转换,很麻烦的。Terac Rome就是用的encodeURIComponent(),del.icio.us和365key用的是escape()。当然,有人这三个函数都不用,自己写过滤函数,我觉得那纯粹是浪费精力。
下面是MSDN上对这三个函数的解释:
escape(charString)
The escape method returns a string value (in Unicode format) that contains the contents of charstring. All spaces, punctuation, accented characters, and any other non-ASCII characters are replaced with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, a space is returned as "%20."
Characters with a value greater than 255 are stored using the %uxxxx format.
Note The escape method should not be used to encode Uniform Resource Identifiers (URI). Use encodeURI and encodeURIComponent methods instead.
http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthescape.asp
encodeURI(URIString)
The encodeURI method returns an encoded URI. If you pass the result to decodeURI, the original string is returned. The encodeURI method does not encode the following characters: ":", "/", ";", and "?". Use encodeURIComponent to encode these characters.
http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthfencodeuri.asp
encodeURIComponent(encodedURIString)
The encodeURIComponent method returns an encoded URI. If you pass the result to decodeURIComponent, the original string is returned. Because the encodeURIComponent method encodes all characters, be careful if the string represents a path such as /folder1/folder2/default.html. The slash characters will be encoded and will not be valid if sent as a request to a web server. Use the encodeURI method if the string contains more than a single URI component.
http://msdn.microsoft.com/library/en-us/script56/html/js56jsmthencodeuricomponent.asp
Steve Lodefink报告了一个像纽扣一样可爱的冷战时期前苏联间谍照相机.它贵得可笑并且很难使用胶卷,但当然很漂亮.
尽管前苏联已经不复存在, 但当时的官僚主义看来还健在, 因为根据LSI, 它用了6个月的工作才将一套MF-1照相机带出这个国家.其中应该要”经过”很多人的手,导致LSI收取1000.00美元每套.
它提供了连同显影池, 绳索, 3个胶卷筒, 还有一个小小的装置用以从小孔处将一卷33毫米的胶卷割成22毫米的. 不幸的是, 只有在特殊的地方才能把胶卷洗出来.
这上面全是0111001101110111011001010110010101110100. 它以二进制拼写了wearer的名字. 链接到Warren Ellis发表的文章.
为了在客齐集上面改一个小东西,晚上忽然突发奇想,作了点尝试,花了大约1个小时的时间,写了点号称是AJAX的东东。简单的来说,就是让任何人可以在我的页面上帮我加批注。尝试一下拿鼠标选中一段文字(最好是一小段)看看。如果不出意外的话,应该有红色的下划线的标注,如果重新刷新一下页面的话,应该还在。为了让界面不是太乱,所以只保留了最新的几个批注。之前的先不显示了。
其实,这个应用是个简单得不能再简单的JavaScript应用,只不过被冠以了AJAX这个今年2月份才诞生的名词以后忽然热了起来。AJAX这一个单词,居然可以把一堆98年就开始用的技术推到前台来,成为当今在特定的圈子里最热的词汇,倒是一个典型的tipping point(临界点)的案例。就像99年Netcenter用的RSS终于在2002年开始被从blogger捡起来,并在2005年焕发了青春。
这些用Javascript+XMLHTTPRequest的做法给我们提供了一个很广阔的空间,可以有很多的想象。比如,在任何静态的页面里面,只要加入这段代码也就可以拥有这个功能了。
<script language=Javascript src="http://home.wangjianshuo.com/scripts/php/markit.php">
</script>
注:那些红线,只是在Word里面随手画的。
注二:没有经过测试,FireFox下面什么样子不晓得,放在其他页面怎么样也不晓得。。