| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 439 人关注过本帖
标题:修改默认输出模式
只看楼主 加入收藏
netee
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-8-21
收藏
 问题点数:0 回复次数:0 
修改默认输出模式
var admin5={
    init:function(){
        
        var elms = document.getElementsByName("sliding");

        for(var g=0; g<elms.length; g++){
            
            var lielms = elms[g].getElementsByTagName('LI');
            
            for(var i=0; i<lielms.length; i++){
                
                lielms[i].onmousedown = function(){
                    
                    var pnobj = this.parentNode.parentNode.nextSibling.tagName == "DIV" ? this.parentNode.parentNode.nextSibling : this.parentNode.parentNode.nextSibling.nextSibling;
                    var objsx = pnobj.getElementsByTagName('UL');
                    var elmsx = this.parentNode.getElementsByTagName('LI');
                    var thisx = 0;
                    
                    for(var j=0; j<elmsx.length; j++){
                        if(elmsx[j] == this) thisx = j;
                        elmsx[j].className="";
                        objsx[j].style.display="none";
                    }
                    
                    this.className='on';
                    objsx[thisx].style.display="";
                    
                }
            }
        }

        if(Cookie.getCookie('smeta'))
        {
            var elms = $('content').getElementsByTagName('DIV');
            for(var i=0; i<elms.length; i++){
                if(elms[i].className == 'box2'){
                    elms[i].style.display = 'none';
                }
            }
            $('content').getElementsByTagName('A')[0].innerHTML='摘要模式';
        }
        
    }
}

function $(element) {
    var elements = new Array();
    if (arguments.length > 1) {
        for (var i = 0, elements = [], length = arguments.length; i < length; i++)
        elements.push($(arguments[i]));
        return elements;
    }
    element = document.getElementById(element);
    return element;
}

var Cookie=new Object();
Cookie.setCookie=function(name,value,option){
    var str=name+"="+escape(value);        
    if(option){
        if(option.expireDays){
            var date=new Date();
            var ms=option.expireDays*24*3600*1000;
            date.setTime(date.getTime()+ms);
            str+="; expires="+date.toGMTString();
        }    
        if(option.path)str+="; path="+path;
        if(option.domain)str+="; domain"+domain;
        if(option.secure)str+="; true";    
    }
    document.cookie=str;
}

Cookie.getCookie=function(name){
    var cookieArray=document.cookie.split("; ");
    var cookie=new Object();
    for(var i=0;i<cookieArray.length;i++){
        var arr=cookieArray[i].split("=");
        if(arr[0]==name)return unescape(arr[1]);
    }
    return "";
}

Cookie.deleteCookie=function(name){
    this.setCookie(name,"",{expireDays:-1});
}

function list_mode(elm){
    
    var elms = $('content').getElementsByTagName('DIV');
    
    if(Cookie.getCookie('smeta')){
        
        for(var i=0; i<elms.length; i++){
            if(elms[i].className == 'box2'){
                elms[i].style.display = 'block';
            }
        }
        Cookie.deleteCookie('smeta');
        elm.innerHTML='标题模式';
        
    }else{
        for(var i=0; i<elms.length; i++){
            if(elms[i].className == 'box2'){
                elms[i].style.display = 'none';
            }
        }
        Cookie.setCookie('smeta',1);
        elm.innerHTML='摘要模式';
    }
}

在线等答案吧!!这段代码是用来隐藏和打开博客的摘要用的,只要想把他修改成默认为影藏摘要,也是就把"div"的box2层隐藏,现在本段代码的效果可以在http://wwwsd. 看到!
搜索更多相关主题的帖子: 摘要 
2009-08-21 21:44
快速回复:修改默认输出模式
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.042710 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved