修改默认输出模式
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. 看到!