日期:2014-05-16  浏览次数:20345 次

请问这样的一个js类库应该如何调用
/* $ 获取指定对象
@element 对象名
可以使用对象名集合,返回值为对象的集合
如果您使用了 Prototype 类库, 请把该函数注释掉
Sams_object.Get() 中同样实现该函数的所有功能
*/
function $(element) 
{
    if (arguments.length > 1) 
    {
        for (var i = 0, elements = [], length = arguments.length; i < length; i++)
          elements.push($(arguments[i]));
        return elements;
    }
    if (typeof element == 'string')
        element = document.getElementById(element);
    return element;
}
/// 浏览器相关操作
var Sams_browse = 
{
        /* 检测浏览信息 */
        checkBrowser : function ()
        { 
            this.ver=navigator.appVersion 
            this.dom=document.getElementById?1:0 
            this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0; 
            this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
            this.ie4=(document.all && !this.dom)?1:0; 
            this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
            this.ns4=(document.layers && !this.dom)?1:0; 
            this.mac=(this.ver.indexOf('Mac') > -1) ?1:0; 
            this.ope=(navigator.userAgent.indexOf('Opera')>-1); 
            this.ie=(this.ie6 || this.ie5 || this.ie4) 
            this.ns=(this.ns4 || this.ns5) 
            this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns5 || this.ns4 || this.mac || this.ope) 
            this.nbw=(!this.bw) 
            return this;
        },
        /* 设为首页
        @url 要设为首页的地址
        */
        SetDefault : function ()
        {
            this.style.behavior='url(#default#homepage)';
            this.setHomePage(