All pastes #576896 Raw Edit

XSLT + JavaScript, IE Bug

public text v1 · immutable
·published 2007-06-19 17:55 UTC
rendered paste body
<xsl:template name="JavascriptTicker" match="/IndexPage/BlogFeed">	
	<table class="blogTicker">
	  <tr>
	    <td class="blogArrows" id="blogTitle">Point2 Heavy Equipment Blog</td>
	    <td class="blogArrows" id="dateStamp">
	    
	    </td>
	    
	    <td id="blogHeadline">
	    
		<span class="headlineTitle" id="bHead"></span>
		
		<xsl:text> * </xsl:text>
			
	    	<a id="postLink"></a>
		    	
	    	<img src="/Xhtml/Images/Ticker/goToBlogArrow.gif" alt="Read Blog Post" width="18" height="9" />
	    </td>
	  </tr>
	</table>
	
	<script type="text/javascript" defer="defer">
		
		var blogPosts = new Array()
		var i = 0
		
		<xsl:for-each select="/IndexPage/BlogFeed/item">
		
			var currentPost = new Array()
			currentPost[0] = &quot;<xsl:value-of select="title"></xsl:value-of>&quot;
			currentPost[1] = &quot;<xsl:value-of select="link"></xsl:value-of>&quot;
			currentPost[2] = &quot;<xsl:value-of select="publishedDate"></xsl:value-of>&quot;
			
			<xsl:variable name="APOS">&apos;</xsl:variable>
			<xsl:variable name="QUOTE">&quot;</xsl:variable>		
			
			currentPost[3] = &quot;<xsl:value-of select="description"></xsl:value-of>&quot;
			blogPosts[i] = currentPost
			i++
			
		</xsl:for-each>
		
		var dateStamp = document.getElementById("dateStamp");
		var blogHeadline = document.getElementById("bHead");
		var link = document.getElementById("postLink");
		
		dateStamp.innerHTML = currentPost[2];
		blogHeadline.innerHTML = currentPost[0];
		link.href = currentPost[1];
		link.innerHTML = currentPost[3];
		
		GetBlogPosts(0);
	</script>
</xsl:template>

//Gets the news source for the blog
function GetBlogPosts(num)
{
	//Looping vars
	var iPost = num;
	var maxPosts = blogPosts.length;
	
	var currentPost = blogPosts[iPost]
	
	//post information
	var title = currentPost[0];
	var url = currentPost[1];
	var publishedDate = currentPost[2];
	var desc = currentPost[3];
	
	//Set the published Date
	var dateStamp = document.getElementById("dateStamp");
	dateStamp.innerHTML = publishedDate
	//Set the title
	var blogHeadline = document.getElementById("blogHeadline");
	blogHeadline.innerHTML = "<span class='headlineTitle'>" + title + "</span> * <a href=" + url + ">" + desc + "</a>";
	
	//Go to the next post
	iPost += 1
	
	//If we're at the last, reset the loop
	if(iPost == maxPosts)
	{
		iPost = 0
	}
	
	//Callback to start the function again
	window.setTimeout("GetBlogPosts(" + iPost + ")", 3000);
}