1.insertBefore
var lielem = document.createElement("li");
var momogrouplistUL = document.getElementById("momogrouplistUL");
//最新消息置顶
var urlength=momogrouplistUL.childNodes.length;
if(urlength==0){
momogrouplistUL.appendChild(lielem);
}else{
for (var i=0;i<=urlength;i++)
{
if (i==0)
{
momogrouplistUL.insertBefore(lielem,momogrouplistUL.childNodes[i]);
break;
}
}
}
2.prepend
//置顶
$("#momogrouplistUL").prepend($("#momogrouplistUL").children("#"+li标签id));