寒江雪 2019-03-15 09:49 采纳率: 0%
浏览 415

JS能实现后台统计新闻字数并输出到页面端吗?

最近做个新闻网站,想在网站后台利用JS函数统计新闻字数,并在前台页面输出值,能实现吗?
就是要在浏览器端“新闻字数”后面输出函数计算的字数值

网页代码如下:



{Stl.SiteName}







<!--头部包含文件-->
/stl:include
  <!--页面当前位置导航-->
  <div class="breadcrumb">
    <stl:location>
      <span class="nail"></span>
    </stl:location>
  </div>

  <div class="maincntwrapper1">
    <div class="part1 c">
      <div class="txtarea">
        <h2 class="title"><stl:content type="Title" ></stl:content></h2>
        <div class="subinfo c">
          <span class="author fl">作者:<stl:content type="Author"></stl:content></span>
          <span class="source fl">来源:<stl:content type="Source"></stl:content></span>
          <span class="update fl">时间: <stl:content type="AddDate" formatString="yyyy-MM-dd HH:mm:ss"></stl:content></span>
          <span class="click fl" >点击:<stl:content type="Hits" isDynamic="true"></stl:content></span>
        </div>
        <div class="txt" >
          <stl:content  type="Content"></stl:content>

        </div>     



        <div class="subinfo c" style="border-bottom:0 solid #000000; border-top: 1px solid #cccccc; text-align:right">
          <span style="margin-right:5px;" >**_新闻字数:_**</span>

                        <span style="margin-right:60px;">新闻录入:<stl:content type="AddUserName"></stl:content></span>
          <span>责任编辑:<stl:content type="LastEditUserName"></stl:content></span>


        </div>
      </div>
    </div>

    <div class="spacerB"></div>
  </div>
    </div> 

<!--底部包含文件-->
<stl:include file="/include/bottom.html"></stl:include>



  • 写回答

1条回答 默认 最新

  • 毕小宝 博客专家认证 2019-03-15 09:57
    关注

    这个需求不复杂,是可以的。
    首先,后台需要提供一个获取统计新闻字数的请求处理方法。
    其次,前端添加“新闻字数”点击事件,发送请求给后台获取统计字数,并回显在前端。
    你是用什么技术做的,搜下相关技术的基本用法。

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办