• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦dedeCMS多彩色tag解决办法
    POST TIME:2021-05-24 02:59
    dede模板实现彩色TAG代码主要由JS+CSS实现 
    作用方法: 
    1、建一个新的*.html文档,将以下代码拷进去,然后保存 
    2、在首页相应的位置进行调用 
    代码如下: 

    复制代码
    <style type="text/css"> 
    .tagCloud{ padding:0 6px; } 
    .tagCloud a { margin:0 8px 0 0; line-height:22px; } 
    .color0{ color:#2F5FC2; } 
    .color1{ color:#AC1BF2; } 
    .color2{ color:#9E6FC5; } 
    .color3{ color:#FBA426; } 
    .color4{ color:#2739CF; } 
    .color5{ color:#C8A453; } 
    .color6{ color:#AB2846; } 
    .weight0{ font-weight:100; } 
    .weight1{ font-weight:300; } 
    .weight2{ font-weight:500; } 
    .weight3{ font-weight:700; } 
    .weight4{ font-weight:900; } 
    .weight5{ font-weight:bold;} 
    .weight6{ font-weight:bolder; } 
    .size0{ font-size:12px; } 
    .size1{ font-size:13px; } 
    .size2{ font-size:14px; } 
    .size3{ font-size:16px; } 
    .size4{ font-size:20px; } 
    .size5{ font-size:22px; } 
    .size6{ font-size:24px; } 
    </style>
     
    <script language="javascript" type="text/javascript"> 
     function setTagCloudStyle(){ 
      var colors = new Array("color0","color1","color2","color3","color4",
      "color5","color6"); 
      var sizes = new Array("size0","size1","size2","size3"); 
      var weights = new Array("weight0","weight1","weight2","weight3",
      "weight4","weight5","weight6"); 
      var colorsLen = colors.length;//获取颜色样式个数 
      var sizesLen = sizes.length;//获取字体大小样式个数 
      var weightsLen = weights.length;//获取字体粗细样式个数 
        
      var tagCloud = document.getElementById("tagCloud"); 
      var tagLinks = tagCloud.getElementsByTagName("a"); 
      var tagLinksLen = tagLinks.length; 
      for(i = 0 ; i < tagLinksLen ; i++){ 
       tagLinks.className = colors[Math.floor(colorsLen*Math.random())] + "
      " + sizes[Math.floor(sizesLen*Math.random())]+ " " +         weights[Math.floor(weightsLen*Math.random())]; 
       //随机设置每个<a>标签的样式,以实现不同效果. 
      } 
     } 
      
     if(document.addEventListener){ 
      window.addEventListener('load',setTagCloudStyle,false); 
     }else{ 
      window.attachEvent('onload',setTagCloudStyle); 
     } 
     //绑定onload事件,在文档载入完毕启动setTagCloudStyle()函数; 
    </script>
    <div class="tagCloud" id="tagCloud">{dede:tag row='20' getall='1' sort='month'}<a href="http://www.dede58.com/[field:link/]">[field:tag /]</a>{/dede:tag}</div>
    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!