-1
function createChatbox (from) {
console.log(from); //from= Hola
var chatBoxId= from+ 'chatbox';
$('#privateChat').append('<div id="'+ chatBoxId +'" class="chatbox"></div>');
$('#' + chatBoxId).draggable({ handle: '.drag' });
$('#' + chatBoxId).append('<p id="titulo" class="drag">Chat privado con: '+ from +'</p> <div id="'+ from +'textchat" class="textchat"></div><form id="msgPrivate" onsubmit="return formSubmit('+ from +')"><input type="text" id="privateMsg" class="texto" required><input type="submit" class="boton" value="Enviar" class="btnLogIn" id="sendPrivate"> ');
}

function formSubmit (from) {
console.log("entro en formSubmit");
console.log("from es: " +from); //from= [object HTMLDivElement]
sendPrivateMessage(from);
return false;
}

そして、formSubmit('+ from +')に行くと、fromは[オブジェクトHTMLDivElement]に変換されます。このオブジェクトからデータを取得するにはどうすればよいですか?

4

1 に答える 1

0

解決策はこれです:

onsubmit="return formSubmit('+'\''+ from +'\''+')"

ありがとう!

于 2013-01-11T23:11:58.563 に答える