<a> not working in javascript string
Okay I have a javascript based twitter plugin for my my website.
I use Jquery ajax to get the JSON, and I then print out the "tweeted content" with the innerHTML of a
tag on my site...
That all works fine, however I wanted to make all of the hashtags and @ links. They way I have this set up is seems to be working, but for some reason the css style sheets will style the link, however the borwser does not treat the links as links.
var dynamicString = data[0].text;
var dispString = "";
while(dynamicString.indexOf("#") != -1)
{
var indexOfHash = 0;
var indexOfSpace =0;
var indexOfHash = dynamicString.indexOf("#");
dispString += dynamicString.slice(0, indexOfHash);
dynamicString = dynamicString.slice(indexOfHash, dynamicString.length);
indexOfSpace = dynamicString.indexOf(" ");
dispString += "<a class='twitterlink' href='http://twitter.com/#!/search/%23";
dispString += dynamicString.s开发者_开发百科lice(1, indexOfSpace);
dispString += "'>" + dynamicString.slice(0, indexOfSpace) + "</a>";
dynamicString = dynamicString.slice(indexOfSpace, dynamicString.length);
}
dispString += dynamicString;
var twitterPTag = document.getElementById('lasttweet');
twitterPTag.innerHTML = "<span id='tweettitle'>Latest Tweet:</span><br />" + dispString;
My website is justinmburrous.com, check out any page for this script working, live.
Change
h2.subpageheader {
color: black;
left: 50%;
margin-left: -350px;
position: absolute;
text-align: left;
top: 81px;
width: 900px;
z-index: 3;
}
it is too wide and the z-index higher than the link
精彩评论