找到了。 PHP: // ############################################################################# // vB_AJAX_TitleEdit // ############################################################################# /** * Class to handle thread title editing with XML-HTTP * * @param object The <td> containing the title element */ function vB_AJAX_TitleEdit(obj) { this.obj = obj; this.threadid = this.obj.id.substr(this.obj.id.lastIndexOf('_') + 1); this.linkobj = fetch_object('thread_title_' + this.threadid); this.container = this.linkobj.parentNode; this.editobj = null; this.xml_sender = null; this.origtitle = ''; this.editstate = false; // ============================================================================= // vB_AJAX_TitleEdit methods /** * Function to initialize the editor for a thread title */ this.edit = function() { if (this.editstate == false) { // create the new editor input box properties... this.inputobj = document.createElement('input'); this.inputobj.type = 'text'; this.inputobj.size = 50; this.inputobj.maxLength = 85; this.inputobj.style.width = Math.max(this.linkobj.offsetWidth, 250) + 'px'; this.inputobj.className = 'bginput'; this.inputobj.value = PHP.unhtmlspecialchars(this.linkobj.innerHTML); this.inputobj.title = this.inputobj.value; // ... and event handlers this.inputobj.onblur = vB_AJAX_ThreadList_Events.prototype.titleinput_onblur; this.inputobj.onkeypress = vB_AJAX_ThreadList_Events.prototype.titleinput_onkeypress; // insert the editor box and select it this.editobj = this.container.insertBefore(this.inputobj, this.linkobj); this.editobj.select(); // store the original text this.origtitle = this.linkobj.innerHTML; // hide the link object this.linkobj.style.display = 'none'; // declare that we are in an editing state this.editstate = true; } } /** * Function to restore a thread title in the editing state */ this.restore = function() { if (this.editstate == true) { // do we actually need to save? if (this.editobj.value != this.origtitle) { this.linkobj.innerHTML = PHP.htmlspecialchars(this.editobj.value); this.save(this.editobj.value); } else { // set the new contents for the link this.linkobj.innerHTML = this.editobj.value; } // remove the editor box this.container.removeChild(this.editobj); // un-hide the link this.linkobj.style.display = ''; // declare that we are in a normal state this.editstate = false; this.obj = null; } } /** * Function to save an edited thread title * * @param string Edited title text * * @return string Validated title text */ this.save = function(titletext) { this.xml_sender = new vB_AJAX_Handler(true); this.xml_sender.onreadystatechange(this.onreadystatechange); this.xml_sender.send('ajax.php', 'do=updatethreadtitle&t=' + this.threadid + '&title=' + PHP.urlencode(titletext)); } var me = this; /** * OnReadyStateChange callback. Uses a closure to keep state. * Remember to use me instead of this inside this function! */ this.onreadystatechange = function() { if (me.xml_sender.handler.readyState == 4 && me.xml_sender.handler.status == 200 && me.xml_sender.handler.responseText) { me.linkobj.innerHTML = me.xml_sender.handler.responseText; if (is_ie) { me.xml_sender.handler.abort(); } vB_ThreadTitle_Editor.obj = null; } } // start the editor this.edit(); }