var text=document.getElementById("文本框的ID").value;//获取textarea内容 document.getElementById('要显示内容的id').value = text; var myDate = new Date();//当前时间 var mytime=myDate.toLocaleTimeString(); //获取标准时间 document.getElementById('要显示时间的id').value=mytime;//显示时间 document.getElementById('要显示号码区域的ID').value=document.getElementById('显示号码的id').value//显示号码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script>
function send(){
var d = new Date();
document.getElementById('txtChat').value+='我说('+tick()+')\n'+document.getElementById('txtIn').value+'\n';
document.getElementById('txtIn').value='';
document.getElementById('txtChat').scrollTop=document.getElementById('txtChat').scrollHeight; }
function tick() {
var years,months,days,hours, minutes, seconds;
var intYears,intMonths,intDays,intHours, intMinutes, intSeconds;
var today;
today = new Date(); //系统当前时间
intYears = today.getFullYear(); //得到年份,getFullYear()比getYear()更普适
intMonths = today.getMonth() + 1; //得到月份,要加1
intDays = today.getDate(); //得到日期
intHours = today.getHours(); //得到小时
intMinutes = today.getMinutes(); //得到分钟
intSeconds = today.getSeconds(); //得到秒钟 years = intYears + "-";
if(intMonths < 10 ){
months = "0" + intMonths +"-";
} else {
months = intMonths +"-";
} if(intDays < 10 ){
days = "0" + intDays +" ";
} else {
days = intDays + " ";
} if (intHours == 0) {
hours = "00:";
} else if (intHours < 10) {
hours = "0" + intHours+":";
} else {
hours = intHours + ":";
} if (intMinutes < 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
} if (intSeconds < 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
} timeString = years+months+days+hours+minutes+seconds;
return timeString;
}
</script></head><body>
<table width="100%" border="1" height="500px" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" width="100%" height="80"><img src="images/Online/AC_detail_banner.jpg" width="100%" height="80"/></td>
</tr>
<tr>
<td><textarea id="txtChat" rows="15" style="width:560px"></textarea></td>
<td width="200" align="center" rowspan="2"><img src="images/Online/AC_img5.jpg" height="200" width="210" /><br /><br /><br /><br /><font style="font-family:'Times New Roman', Times, serif; font-size:14px; color:#666666">王工(生技科)</font></td>
</tr>
<tr>
<td><textarea id="txtIn" rows="8" style="width:560px"></textarea><div align="right"><input type="button" onclick="send()" name="btnSend" id="btnSend" value="发 送"/> </div></td> </tr>
</table>
</body>
</html>
你自己改成动态的就行了 发送者的号码是从后来传过来的或者当前页面可以取到的吧?
var text=document.getElementById("文本框的ID").value;//获取textarea内容
document.getElementById('要显示内容的id').value = text;
var myDate = new Date();//当前时间
var mytime=myDate.toLocaleTimeString(); //获取标准时间
document.getElementById('要显示时间的id').value=mytime;//显示时间
document.getElementById('要显示号码区域的ID').value=document.getElementById('显示号码的id').value//显示号码