var intervalID;
function autoUpdateFeed()
{
if( document.autoupdatefeedform.autoupdatefeed.checked == true )
{
intervalID = setInterval(updateFeed, 1000);
} else {
clearInterval(intervalID);
}
}
function updateFeed()
{
var oRequest;
try {
oRequest=new XMLHttpRequest();
} catch (e) {
try {
oRequest=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
oRequest=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
oRequest.onreadystatechange=function()
{
if(oRequest.readyState==4)
{
//Start of problem.
var newfeedstable = document.getElementById("newfeeditems");
var newcontent = document.createElement('tr');
newcontent.innerHTML = oRequest.responseText;
while (newcontent.firstChild)
{
newfeedstable.insertBefore(newcontent.firstChild, newfeedstable.firstChild);
}
//End of problem.
}
}
oRequest.open("GET","back/newsfeedlatest.php",true);
oRequest.send(null);
}
これは、私と私の友人が現在、仕掛品のソーシャルネットワーキングサイトで新しいステータスの更新のためにテーブルに新しいステータスの更新を追加するために使用しているJavaScriptコードです。問題は、新しい要素がテーブルに追加されると、それらが並べて表示されることです。下に並べるのではなく、横に並べるので、なぜこれが起こっているのか、そしてそれを修正する方法を知る必要があります、何かアイデアはありますか?詳細については、Webサイトを参照してください。アカウントを作成する必要がある場合がありますが、電子メールアクティベーションの使用を再開するまで、偽の電子メールを自由に使用してください。http://friendgrid.com/ これは、さらに参照できるように問題のスクリーンショットです:http: //dl.dropbox.com/u/2281426/Newsfeed%20Error.bmp