Tag Cloud JS + Flash. Not clickable?
- by Alex
Hello all,
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("https://kynetx-images.s3.amazonaws.com/tagcloud.swf", "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");
}