So when I load a page php grabs some results and formats them for the user. This shows properly in all browsers. However, when I try to use an ajax request to get more data and then format it, the same styling doesnt work. It is causing the text to appear below the image, not floated next to it. Also the dynamic styling works fine on Safari and Chrome, but not in Firefox (only mac tested) and IE. Here’s my code:
var tweetdiv=document.createElement('div');
tweetdiv.setAttribute('id', 'tweets');
tweetdiv.style.borderBottom='1px solid #6802c4';
tweetdiv.style.width='100%';
tweetdiv.style.overflow='hidden';
tweetdiv.style.padding='5px 0px 7px 0px';
tweetdiv.style.display='block';
if(different)
tweetdiv.style.backgroundColor='#252424';
var imagediv=document.createElement('div');
imagediv.style.height='100%';
imagediv.style.float='left';
imagediv.style.width='50px';
imagediv.style.paddingRight='7px';
imagediv.style.marginLeft='7px';
var img=document.createElement('img');
img.setAttribute('src', json[x].user.profile_image_url);
img.style.width='50px';
img.style.height='50px';
var alink=document.createElement('a');
alink.setAttribute('href', "#)");
alink.appendChild(img);
imagediv.appendChild(alink);
tweetdiv.appendChild(imagediv);
var tweetcon=document.createElement('div');
tweetcon.style.float='left';
tweetcon.style.width='79%';
var spanuser=document.createElement('span');
spanuser.style.textAlign='left';
spanuser.style.color='#CCCCCC';
spanuser.innerHTML="<span style='color:#fff; font-size:12px'><a href='#'><b>"+json[x].user.screen_name+"</b></a></span> "+text;
tweetcon.appendChild(spanuser);
var pos=document.createElement('div');
pos.style.position='relative';pos.style.top='6px';
var intwo=document.createElement('input');
intwo.setAttribute('type', 'hidden');
intwo.setAttribute('name', 'tweetepoch');
intwo.setAttribute('value', Math.floor(save/1000));
pos.appendChild(intwo);
var sp=document.createElement('span');
sp.style.color='#999999';
sp.style.textAlign='left';
sp.innerHTML="<span id='timetweet'>"+formatTime+"</span> via "+link+"";
var sp2=document.createElement('span');
sp2.style.float='right';
sp2.style.marginTop='-7px';
var favorite_check='favorite.png';
if(json[x].favorited)
favorite_check='favorited.png'
var rt='RT @'+json[x].user.screen_name+' '+json[x].text;
rt=rt.replace(/'/g,"");
rt=rt.replace(/"/g,"");
rt=rt.replace(/'/g,"");
rt=rt.replace(/"/g,"");
sp2.innerHTML="<a class='reply' href='#' >Reply</a> <a class='reply' href='#' >ReTweet</a> <a href='#' class='favorite'><img id='favorited' style='width:14px; margin-top:3px;height:auto;'src='"+favorite_check+"' /></a>";
pos.appendChild(sp);
pos.appendChild(sp2);
tweetcon.appendChild(pos);
tweetdiv.appendChild(tweetcon);