-9

私はすべてを試しましたが、間違いがどこにあるのかわかりません.

<script type="text/javascript">
function postToStatus(action,type,user,ta){
var data = _(ta).value;
if(data == ""){
    alert("Type something first weenis");
    return false;
}
_("statusBtn").disabled = true;
var ajax = ajaxObj("POST", "php_parsers/qp_system.php");
ajax.onreadystatechange = function() {
    if(ajaxReturn(ajax) == true) {
        var datArray = ajax.responseText.split("|");
        if(datArray[0] == "post_ok"){
                var sid = datArray[1];
                data = data.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g," ><br />").replace(/\r/g,"<br />");
                var currentHTML = _("statusarea").innerHTML;
                _("statusarea").innerHTML = '<div id="status_'+sid+
                'class="status_boxes"><div><b>Posted by you just now:</b><span >id="sdb_'+sid+
                '"><a href="#" onclick="return false" >onmousedown="deleteStatus("'+sid+
                '\',\'status_'+sid+
                '\');" title="DELETE THIS STATUS AND ITS REPLIES">delete status</a>    ></span><br />'+data+
                '</div></div>"'+currentHTML;
                _("statusBtn").disabled = false;
                _(ta).value = "";
        } else {
                alert(ajax.responseText);
        }
    }
}
ajax.send("action="+action+"&type="+type+"&user="+user+"&data="+data);
}
4

1 に答える 1

2

ajax.send() 呼び出しの直前の最後の } の後にセミコロンを置く必要があります。

この Web サイトは、JavaScript を作成する場合の親友です: http://closure-compiler.appspot.com/home

function postToStatus(action, type, user, ta) {
  var data = _(ta).value;
  if (data == "") {
    alert("Type something first weenis");
    return false;
  }
  _("statusBtn").disabled = true;
  var ajax = ajaxObj("POST", "php_parsers/qp_system.php");
  ajax.onreadystatechange = function() {
    if (ajaxReturn(ajax) == true) {
      var datArray = ajax.responseText.split("|");
      if (datArray[0] == "post_ok") {
        var sid = datArray[1];
        data = data.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\n/g, " ><br />").replace(/\r/g, "<br />");
        var currentHTML = _("statusarea").innerHTML;
        _("statusarea").innerHTML = '<div id="status_' + sid + 'class="status_boxes"><div><b>Posted by you just now:</b><span >id="sdb_' + sid + '"><a href="#" onclick="return false" >onmousedown="deleteStatus("' + sid + "','status_" + sid + '\');" title="DELETE THIS STATUS AND ITS REPLIES">delete status</a>    ></span><br />' + data + '</div></div>"' + currentHTML;
        _("statusBtn").disabled = false;
        _(ta).value = "";
      } else {
        alert(ajax.responseText);
      }
    }
  };
  ajax.send("action=" + action + "&type=" + type + "&user=" + user + "&data=" + data);
}
;
于 2013-11-11T17:15:24.610 に答える