空间发表说说html页面实现原理,HTML 发表说说 制作方法

18c998c0e81493063523d65837100183.png

======而有的生过脑单近需一相涯前网选近需一相涯================================================================================================览需下有都视事房站有行移域图于带近器求了点差图态子的等定动上标的的近器求了点差图态子的等定动上标的的近器求了点差图态子的等定动上标的的近器求了点差图态子的等定动上标的的近器求了点差图态子的等定动上标的的近器=

*{ margin:0; padding:0}

ul{ list-style:none}

.wrap{ width:500px;font-size:14px; margin:50px auto}

.countTxt{ display:block; text-align:right; padding-bottom:10px;}

.countTxt em{ font-size: 16px; font-weight: bold; font-style: normal; padding: 0 5px}

.countTxt .red{ color: red;}

textarea{ padding:10px; display:block; width:480px; resize:none; height:100px; border:1px solid #ccc; font-size:14px}

.commonBtn{ height:40px; width:100px; border:1px solid #ccc; margin:10px 0 0 380px}

hr{ margin:20px 0}

.talkList li{ border:1px solid #ccc; padding:35px 20px 20px; border-radius:10px; position:relative; margin-bottom:20px}

.talkList li p{min-height:50px; margin-bottom:10px; word-break:break-all}

.talkList li .toolsBar{ text-align:right}

.talkList li .toolsBar span{ margin-left:20px; cursor:pointer}

.talkList li time{ position:absolute; top:10px; right:15px; color:#ccc;}

您还可以输入140

发表说说


function isChinese(str){//判断是不是中文 中文:true 字符:false

var reCh=/[u00-uff]/;

return !reCh.test(str);

}

$("textarea").keyup(function(){

var txtval=$(this).val();

$(".commonBtn").prop("disabled",txtval==""?true:false);//设定按钮

var str_length=0;//初始定义长度为0;

for(var i=0;i

if(isChinese(txtval.charAt(i))){str_length=str_length+2}//中文为2个字符

else{str_length=str_length+1}//英文为1个字符

}

str_length=Math.ceil(str_length/2);//中英文相加除2 向下取整数(一个中文 + 一个英文)

var count=140-str_length;

if(count<0){

$(".countTxt").html('超出'+Math.abs(count)+'字');

$(".commonBtn").prop("disabled",true);

}else{

$(".countTxt").html("您还可以输入"+count+"字")

}

})

//--------------------------------------------------------

$(".commonBtn").click(function(){

var txt=$("textarea").val();

var inHTML="";

inHTML+='

'+

'

'+txt+'

'+

'

'+

'顶 0'+

'踩 0'+

'

'+

''+

'';

$(inHTML).prependTo(".talkList");

$("textarea").val("");

$(".commonBtn").prop("disabled",true);

count=140;

$(".countTxt").html("您还可以输入"+count+"字");

var oDate=new Date();//读取当前时间

var year=oDate.getFullYear();//读取年份

var month=oDate.getMonth();//读取月份

var today=oDate.getDate();//读取日期

var hours=oDate.getHours();//读取小时

var min=oDate.getMinutes();//读取分钟

$("time").text(year+"-"+(month+1)+"-"+today+" "+hours+":"+min);

$(".toolsBar span").eq(0).click(function(){

var i=$(this).children("b").text();

i++;

$(this).children("b").text(i);

})

$(".toolsBar span").eq(1).click(function(){

var i=$(this).children("b").text();

i++;

$(this).children("b").text(i);

})

})

本文来源于网络:查看 >https://www.cnblogs.com/lypyongpeng/p/7077565.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值