문제

I've implemented a tag cloud on a site of mine, and I'm using a JS script to populate it, but for some reason, the actual text in the tag cloud is not clickable. It displays and works correctly, but the actual text of the cloud is not getting treated as a link for some odd reason. My question is:

In my script below, do you see anything that I need to fix in order to make my tag cloud's text actually be links?

The site I've implemented it on is a stackexhange site that I run, it is supposed to be a cloud of the "recent tags."

CloudPopulator.js


<script type="text/javascript">
var divRecentTags = document.getElementById("recent-tags");
if (divRecentTags) {
var cloud = new SWFObject("some/swfObject/url",    "tagcloudflash", "200", "200", "9", "#ffffff");
cloud.addParam("allowScriptAccess", "always");
cloud.addVariable("tcolor", "0x0a94d6");
cloud.addVariable("tcolor2", "0xC0C0C0");
cloud.addVariable("hicolor", "0x000000");
cloud.addVariable("tspeed", "150");
cloud.addVariable("distr", "true");
cloud.addVariable("mode", "tags");
var aTags = divRecentTags.getElementsByTagName("a");
var tagHtml = "";
for(var i = 0; i < aTags.length; i++) {
    var hrefText = aTags[i].getAttribute("href");
    var cssText = aTags[i].className;
    var tagName = $(aTags[i]).text();
    var styleText = "style=\'font-size: 8pt;\'";
    if (cssText == "post-tag pop1") {
        var styleText = "style=\'font-size: 15pt;\'";
    }
    else if (cssText == "post-tag pop2") {
        var styleText = "style=\'font-size: 22pt;\'";
    }
    var newLinkText = "<a href=\'"+hrefText+"\'"+styleText+">"+tagName+"</a>";
    tagHtml = tagHtml + newLinkText;
}
cloud.addVariable("tagcloud", escape("<tags>" + tagHtml + "</tags>"));
cloud.write("recent-tags");
}
</script>
도움이 되었습니까?

해결책

Why do you suspect the JS is the problem? If you put in the data in the flash itself, does it have the same issue? If so, look at your TextFields and make sure they're rendering as HTML and are firing the correct events.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top