Question : javascript variable causes loop fail

In the attached code when I add the variable blogBody the loop fails. How can I fix this?

thanks
1:
2:
3:
4:
5:
6:
7:
8:
9:
var blogBody = "";

	 if (searchType == "BlogPost") // only showing an example of BlogPost for now
	 {
           for (var i = 0; i < 10; i++)
		   blogBody = searchResults[i].PostDate;
             htmlString += "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\" height=\"100\"><div align=\"center\"><img src=\"" + searchResults[i].PostAuthor.AvatarPhotoUrl + "\" width=\"80\" /><br />" + searchResults[i].PostAuthor.DisplayName + "</div></td><td width=\"10\" valign=\"top\">&nbsp;</td><td width=\"480\" valign=\"top\"><div class=\"blog_title_text\"><a href=\"" + searchResults[i].Url + "\">" + searchResults[i].PostTitle + "</a></div><div class=\"blog_body_text\">" + searchResults[i].PostBody.substring(0, 250) + "...</div><strong>&nbsp;&nbsp;&nbsp;&nbsp;posted on:</strong>" + blogBody + "</td></tr></table><br />";
			
            }

Answer : javascript variable causes loop fail

not sure but i gurss there is one {} missing for for loop...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var blogBody = "";

	 if (searchType == "BlogPost") // only showing an example of BlogPost for now
	 {
           for (var i = 0; i < 10; i++)
           {
		   blogBody = searchResults[i].PostDate;
             htmlString += "<table width=\"600\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"80\" height=\"100\"><div align=\"center\"><img src=\"" + searchResults[i].PostAuthor.AvatarPhotoUrl + "\" width=\"80\" /><br />" + searchResults[i].PostAuthor.DisplayName + "</div></td><td width=\"10\" valign=\"top\">&nbsp;</td><td width=\"480\" valign=\"top\"><div class=\"blog_title_text\"><a href=\"" + searchResults[i].Url + "\">" + searchResults[i].PostTitle + "</a></div><div class=\"blog_body_text\">" + searchResults[i].PostBody.substring(0, 250) + "...</div><strong>&nbsp;&nbsp;&nbsp;&nbsp;posted on:</strong>" + blogBody + "</td></tr></table><br />";
	}		
            }
Random Solutions  
 
programming4us programming4us