看别人的一个代码,发现第一段就这样写
if (!document.getElementById)
    document.getElementById = function() { return null; }getElementById应该是document的方法,这里怎么直接判断呢
还有后面,直接让function返回值,没有函数,这种写法没有见过请指教

解决方案 »

  1.   

    if (!document.getElementById)
        document.getElementById = function() { return null; }
    如果document对象没有getElementById这个方法,给它添加一个这个方法。并且指向一个函数的说。
      

  2.   

    购买虚拟主机送域名 安全稳定!
    1. 火爆推出:1个国际/国内域名+100M网页空间+企业邮局,惊爆价188元/年。
    详情登陆网站 http://deidc.com/services/special1. 火惊爆价: 200M网页空间 118元/年。
    了解详情登陆中频网站 http://deidc.com/Services/Hosting/popularity.aspDNN虚拟主机
    http://www.deidc.com/Services/Hosting/dnn.aspcoldfusion虚拟主机,支持.CFM 和.CFC,coldfusion7.0
    http://www.deidc.com/Services/Hosting/coldfusion.aspASP.net2.0虚拟主机,送SQL数据库
    http://www.deidc.com/Services/Hosting/business.aspFlash Remoting for .NET虚拟主机
    http://www.deidc.com/Services/Hosting/Flash_Remoting.asp
    网页制作免费教程站 http://homepage.deidc.com