Help me validate this code please

Soldato
Joined
1 Sep 2005
Posts
10,001
Location
Scottish Highlands
I've got a piece of code on my website for integrating my twitter feed. It works very nicely, and removes @replies etc. However it doesn't validate as html strict which I would like it to. I think the problem is that there is a DIV within the javascript which isn't allowed, but it needs to be there. Is there any way of getting around this problem? The script takes the twitter content from my twitter account, arranges it as specified in the template line, then outputs it into the tweet div.

Code:
<script type="text/javascript" charset="utf-8">
	getTwitters('tweet', { 
	id: 'Alasdair_Fowler', 
	count: 3, 
	enableLinks: true, 
	ignoreReplies: true, 
	clearContents: true,
	template: '<div id="tweetline"><span class="name"><img height="20" width="20" src="%user_profile_image_url%" alt="user profile" /> <a href="http://twitter.com/%user_screen_name%">%user_name%</a> said: </span> <span class="message">"%text%"</span> <span class="twittertime"><a href="http://twitter.com/%user_screen_name%/statuses/%id%">%time%</a></span></div>' 
	});
</script>

Code:
<div id="tweet">
	<div id="tweetloader">
 	          <img src="/Miscimages/twitterload.gif" alt="twitter loader" />
           </div>
</div>
 
out of interest MK, are you any nearer to solving the problem with opera mis-ordering the output of dates? Just looking into this myself...

Nope, I really don't understand why opera is doign that at all. Anyone else know why this is happening? I have another script that works out the date of a posted tweet and outputs a relative date;

Code:
function formatDate(date) {
            var ds = date.toDateString().split(/ /),
                mon = ds[1],
                day = ds[2],
                dayi = parseInt(day),
                year = date.getFullYear(),
                thisyear = (new Date()).getFullYear(),
                th = 'th';
            
            // anti-'th' - but don't do the 11th, 12th or 13th
            if ((dayi % 10) == 1 && day.substr(0, 1) != '1') {
                th = 'st';
            } else if ((dayi % 10) == 2 && day.substr(0, 1) != '1') {
                th = 'nd';
            } else if ((dayi % 10) == 3 && day.substr(0, 1) != '1') {
                th = 'rd';
            }
            
            if (day.substr(0, 1) == '0') {
                day = day.substr(1);
            }
            
            return mon + ' ' + day + th + (thisyear != year ? ', ' + year : '');
        }
(That's only a small part of the full js file btw.)

And it works great in Firefox and IE as the output looks like;
9:16pm May 17th
But in Opera it reorders the output to;
9:16pm 17 Mayth

Wtf is that all about? Any ideas why it is doing that?
 
Back
Top Bottom