一个“精湛”的JS程序

一个“精湛”的JS程序

下面是一个很“精湛”的JS程序:

http://rmd.atdmt.com/tl/DocumentDotWrite.js

这个JS文件中“精湛”之处在于,其只有一行代码,如下所示:

function DocumentDotWrite(s){document.write(s);}

下面这个贴子讨论了这个JS文件:
http://forums.thedailywtf.com/forums/p/7872/147330.aspx

大家都在猜测为什么那个程序员要这么干,下面是一些猜测:

  1. 网友superjer说:这是一个伟大的创造,解决了你的键盘“.”键损坏的情况。
  2. 网友Heron说:这是从Character Map上拷贝粘贴下来的。
  3. 网友mfah说:这是世界上第一个用C来包装Javascript的示例。
  4. 网友djork说:我是一个用手机编程的人,这个方法可以让人在手机上更容易输入我的代码。
  5. 网友PSWorx说:可能他们想把document.write作为一个回调函数,但直接把document.write传进去不行。
  6. 还有一个网友说:这么做或者可以阻止网页上的广告阻截器。

呵呵,看来,“超级天才”和“极端愚蠢”可能只是一线之差,只有写这段程序的那个程序员才知道为什么要这么干了。也许,他的键盘的那个键真的是坏了也不一定。

(转载本站文章请注明作者和出处 酷 壳 – CoolShell ,请勿用于任何商业用途)

好烂啊有点差凑合看看还不错很精彩 (12 人打了分,平均分: 3.83 )
Loading...

一个“精湛”的JS程序》的相关评论

  1. 直接在原页面写document.write 不能过 HTML validation,这也是为什么这个东西要单独一个js文件的缘故,算是作弊,上面的几种说法都不能解释为什么要单独放一个文件里。

  2. 我认为drekka说得对,如果让程序适合移植的话,把的确的外部对象包裹起来。比如,外部程序的输出不用document.write、也许是xdocument.write呢?这是一个常见场景。

  3. 可以便于调试,例如在debug=true时,可以覆盖掉着方法,把输出到console之类。

  4. 打印字符的时候 调试用的吧

    如果真的是 . 键坏了

    那他 函数里面的 . 用什么打进去? 用铅笔在显示器上点点?

  5. However you don’t have to be concerned a lot, you are able to study from the next [url=http://cheapltbagshandbagsoutlet3.info]louis vuitton handbags[/url] reading through.
    You’ll find clean [url=http://cheapltbagshandbagsoutlet3.info]cheap louis vuitton bags[/url] styles of those fashionable purses in most season.
    Lastly, [url=http://ltbagshandbagsuk3.info]louis vuitton handbags[/url] is really a well-known manufacturer on the planet.
    Beneficial, isn’t it time intended for variables [url=http://lthandbagsaustralia.info]cheap louis vuitton bags[/url] which often women of all ages off a long time are typically loco concerning this type of wild animals?
    These types of [url=http://cheapltbagshandbagsoutlet3.info]cheap louis vuitton bags[/url] tend to be fashionable, unique as well as made by best assets.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注