日期:2014-05-16  浏览次数:20774 次

将textarea输入框内容置空
function saveReview(str,id){
//str 是textarea的id
var s = document.getElementById(str).value;
createXMLHttpRequest();
xmlHttp.open("GET","Review_SaveReview.action?timeStamp="+ new Date().getTime()+"&tsreview.contents="+s+"&tsreview.tsBlog.blogid="+id,true);
xmlHttp.send(null);
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {  
  $("#"+str).val("");//执行成功了后把textarea的内容置为空
var s = "comment_list_before_"+id;
$("#"+s).after(xmlHttp.responseText);
}
}
};
}
所有语句都执行成功了,唯独textarea置为空没执行,,求指教

------解决方案--------------------
jquery操作textarea,html val 皆可

楼主确定执行了xmlHttp.status == 200?

id是否正确?