10-04
14
dede:hotword 随机颜色效果
作者:Java伴侣 日期:2010-04-14
修改 hotwords.lib.php
$hotword .= " <a href='".$cfg_phpurl."/search.php?keyword=".urlencode($row['keyword'])."' name='mytag'>".$row['keyword']."</a> ";
在模板页面配置:
{dede:hotwords num='18' subday='365' maxlength='16' /}
<script>
var obj = document.getElementsByName("mytag");
for(i=0;i<obj.length;i++)
{
var str = "0123456789abc";
var t = "#";
for(j=0;j<6;j++)
{t = t+ str.charAt(Math.random()*str.length);}
obj[i].style.color=t;
}
</script>
$hotword .= " <a href='".$cfg_phpurl."/search.php?keyword=".urlencode($row['keyword'])."' name='mytag'>".$row['keyword']."</a> ";
在模板页面配置:
{dede:hotwords num='18' subday='365' maxlength='16' /}
<script>
var obj = document.getElementsByName("mytag");
for(i=0;i<obj.length;i++)
{
var str = "0123456789abc";
var t = "#";
for(j=0;j<6;j++)
{t = t+ str.charAt(Math.random()*str.length);}
obj[i].style.color=t;
}
</script>
评论: 0 | 引用: 0 | 查看次数: 391
发表评论