老大 我要向你学习这个:<script language="javascript">
//wondful signature collapse for discuz 4.1.0
//http://www.discuzplus.com
//power by lu5266(www.5466.ik8.com)
function write_cookie(cookie_name,style_display,sign_uid){
collapsed = getcookie("dpt_sign_collapse");
cookie_start = collapsed ? collapsed.indexOf(cookie_name) : -1;
cookie_end = cookie_start + cookie_name.length + 1;
if(style_display == "none" && sign_uid != "-1" || sign_uid == "-2") {
if(cookie_start != -1) {
collapsed = collapsed.substring(0, cookie_start) + collapsed.substring(cookie_end, collapsed.length);
}
}else{
if(cookie_start == -1){
collapsed = collapsed + cookie_name + " ";
}
}
expires = new Date();
expires.setTime(expires.getTime() + (collapsed ? 86400 * 1000 * 30 * 12 : -(86400 * 30 * 1000)));
document.cookie = "dpt_sign_collapse=" + escape(collapsed) + "; expires=" + expires.toGMTString() + "; path=/";
}
function dpt_sign_collapse(sign_uid,hide_all){
authorobj = document.getElementsByTagName("tbody");
autimgobj = document.getElementsByTagName("img");
for(var AI=0; AI < autimgobj.length; AI++){
if(typeof(autimgobj[AI].name) != "undefined"){
issign = hide_all ? (autimgobj[AI].name.indexOf('ignature_img_') > 0 ? 1 : 0 ) : (autimgobj[AI].name == 'signature_img_'+ sign_uid ? 1 : 0);
if(issign){
if((autimgobj[AI].src.toString().indexOf("_yes.gif") > 0 && sign_uid !="-1" ) || sign_uid =="-2" ){
autimg_re = new RegExp("_yes\\.gif$");
autimgobj[AI].src = autimgobj[AI].src.replace(autimg_re, '_no.gif');
}else{
autimg_re = new RegExp("_no\\.gif$");
autimgobj[AI].src = autimgobj[AI].src.replace(autimg_re, '_yes.gif');
}
}
}
}
for(AI=0; AI < authorobj.length; AI++){
if(typeof(authorobj[AI].name) != "undefined"){
issign = hide_all ? (authorobj[AI].name.indexOf('ignature_') > 0 ? 1 : 0) : (authorobj[AI].name == 'signature_'+ sign_uid ? 1 : 0);
if(issign){
write_cookie(authorobj[AI].name,authorobj[AI].style.display,sign_uid);
authorobj[AI].style.display = authorobj[AI].style.display == "" || sign_uid =="-1" ? "none" : "";
}
}
}
}
</script> |