本帖最后由 plglenn35 于 2010-01-01 01:09:28 编辑

解决方案 »

  1.   

    可以,只是这些代码的话<script>
     var $ = function(element) {
            //如果是字符串,就取以该字符串为ID的扩展对象;
            //如果是对象,直接返回扩展对象
            return $.prototype.extend(typeof element == 'string' ? document.getElementById(element) : element, $.prototype);
        };    var fn = $.prototype = 
        { 
            //实现简单继承功能 
            extend: function(dest, source) { 
                for (var i in source) dest[i] = source[i]; 
                return dest; 
            }
        }
    window.onload=function(){
    alert($("p"))
    }
    </script>
    <div id="p"></div>