How to display the current time in right side corner of Text Area?

smartboyalex

New Member
In my Customer side chat application jsp page , I have a text area that displays the messages from the Agent side and also displays the message from the customer .That works fine.My javaScript code is, \[code\]function sendMessage(){ message =trim( document.getElementById("message").value); document.getElementById("message").valuehttp://stackoverflow.com/questions/14069681/= ""; if(message != null && message !="null" && message !=""){ try { xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var checkMsg = trim(xmlhttp.responseText.toString()); textarea = document.getElementById('textarea'); if(checkMsg != "null" && checkMsg != null && trim(checkMsg).length != 0) { if(trim(textarea.value) == ""){ textarea.value = http://stackoverflow.com/questions/14069681/message = checkMsg; textarea.scrollTop = textarea.scrollHeight; } else{ textarea.value +="\n"+checkMsg; textarea.scrollTop = textarea.scrollHeight; } } } }; xmlhttp.open("POST", "SendMessageAction",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("charset","UTF-8"); xmlhttp.send("sessionId="+encodeURIComponent(sessionId)+"&userId="+encodeURIComponent(userId)+"&securekey="+encodeURIComponent(secureKey)+"&message="+encodeURIComponent(message)+"&sid="+Math.random()); } catch(err) { alert(err.description); } }}\[/code\]In that I need to include the current time with the every messages appending in the text area at the right side corner of text area.I can append the current time with messages but I need to append it in right side corner of textarea with every messages?How can I do this.Please give some ideas or some code.
 
Back
Top