php开源在线聊天室,在线聊天室制作 | Online-Chat

html>

AJAX TEST  留言板

*{

margin:0;

padding:0;

}

#wrap{

margin:10px auto;

width:500px;

height:600px;

border:0;

border-radius:10px;

padding:10px;

background:#fff;

box-shadow:0 0 10px rgba(0,0,0,0.1);

}

#content{

position:absolute;

width:280px;

height:380px;

background:#eee;

padding:10px;

border-radius:5px;

font-size:14px;

color:#888;

}

#content #cShow{

margin-top:5px;

width:280px;

height:355px;

padding-top:5px;

text-indent: 5px;

border-radius:5px;

background:#fff;

box-shadow:0 0 10px rgba(0,0,0,0.1);

}

#list{

float:right;

width:190px;

height:380px;

padding:10px;

border-radius:5px;

font-size:14px;

color:#888;

background:#eee;

}

#list #nameList{

margin-top:5px;

width:190px;

height:355px;

padding-top:5px;

text-indent: 5px;

border-radius:5px;

background:#fff;

box-shadow:0 0 10px rgba(0,0,0,0.1);

}

#form{

margin-top:410px;

width:480px;

height:170px;

padding:10px;

border-radius:5px;

background:#eee;

}

#form #getInfo{

width:480px;

height:125px;

border:0;

border-radius:5px;

box-shadow:0 0 10px rgba(0,0,0,0.1);

font-size:14px;

text-indent:5px;

padding-top:5px;

}

#form #getName{

width:170px;

height:32px;

margin-top:7px;

font-size:14px;

text-indent:5px;

color:#999;

border:0;

border-radius:3px;

box-shadow:0 0 10px rgba(0,0,0,0.1);

}

#form span{

font-size:14px;

color:#888;

margin-left:5px;

}

#form #submit{

float:right;

width:100px;

height:31px;

margin-top:7px;

border:0;

border-radius:3px;

box-shadow:0 2px 1px rgb(145,13,35);

background:#e8554e;

color:#fff;

cursor:pointer;

}

#form #submit:hover{

background:#555;

box-shadow:0 2px 1px black;

}

内容显示如下:
当前在线名单:

Status:

$(function(){

$("#submit").bind("click",function(){

if(($('#getInfo').val()!='')&&($('#getName').val()=='')){alert('请输入姓名');}

if(($('#getInfo').val()=='')&&($('#getName').val()!='')){alert('请输入信息');}

if(($('#getInfo').val()=='')&&($('#getName').val()=='')){alert('请输入姓名和信息');}

if(($('#getInfo').val()!='')&&($('#getName').val()!='')){

$('#status').html("Starting……");

setTimeout(function(){

$('#status').html("Stop!");

},2000)

addName();

addMsg();

$('#getInfo').val("");

$('#getName').val("");

return false;

}

})

})

function addName(peopleName){

var peopleName = $('#getName').val();

if(peopleName){

var $name = "

"+peopleName+"";

$('#nameList').append($name);

}

}

function addMsg(){

var dates = new Date();

var years = dates.getFullYear();

var month = dates.getMonth()+1;

var days = dates.getDay();

var hours = dates.getHours();

var minutes = dates.getMinutes();

var seconds = dates.getSeconds();

var time = years+"年"+month+"月"+days+"日"+hours+":"+minutes+":"+seconds;

var $people_name = $("#getName").val();

var $people_info = $("#getInfo").val();

var $fullMsg = ""+"“"+$people_name+"”"+"于"+"&nbsp"+time+"&nbsp"+"说:"+$people_info+""+"";

$("#cShow").append($fullMsg);

}

下面是案例界面:

72ad6ea744110d6f629ad4b6f218e297.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值