SoFunction
Updated on 2025-04-08

js simulate Weibo post message

Without further ado, please see the code:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>jsSimulate Weibo posting message</title>
  </head>
  <style>
    *{
      padding: 0;
      margin: 0;
    }
    .box{
      width: 600px;
      height:auto;
      margin: 100px auto;
      border: 1px solid #ccc;
      padding: 20px;
    }
    .box span{
      line-height: 36px;
    }
    input{
      width: 450px;
      padding: 10px;
    }
    .text-box {
      display: inline-block;
      width: 450px;
     text-align: left;
     min-height: 30px;
     line-height: 26px;
     border: 1px solid #ddd;
     padding: 3px 8px;
    }
    ul{
      margin: 20px auto;
      margin-left: 70px;
      width: 450px;
      list-style:none ;
    }
    li{
      border-bottom: 1px dashed #ddd;
      line-height: 34px;
      margin: 5px 0;
      overflow: hidden;
    }
    ul li .date{
      float: right;
      margin-right: 10px;
      font-size: 12px;
    }
    ul li a{
      float: right;
    }
    button{
      padding: 6px 12px;
    }
  </style>
  <body>
    <div class="box">
      <span>Posted on Weibo</span>
      <!--<input type="" name="" id="" value="" />-->
      <div contenteditable="true" class="text-box form-control"></div>
      <button>release</button>
      <!--<ul>
        <li>
          123123
          <a href="javascript:" rel="external nofollow" rel="external nofollow" >delete</a>
          <span class="date">2017/2/22</span>
        </li>
      </ul>-->
    </div>
  </body>
</html>
<script type="text/javascript">
  =function(){
    var box=("box")
    var txt=("text-box");
    var btn=("button")[0];
    var ul=("ul");
    (ul);
    =function(){
      if (=='') {
        alert('Can't be empty');
        return false;
      }
      var myDate = new Date();
      var time=();
      var li=("li");
      (li);
=+'<a href="javascript:" rel="external nofollow" rel="external nofollow" >delete</a><span class="date">'+time+'</span>';
      ='';
      var lis=;
      if (lis==0) {
        (li);
      } else{
        (li,lis[0])
      }
// Delete function      var dele=("a");
      for (var k = 0; k < ; k++) {
        dele[k].onclick=function(){
          ();
        }
      }
    }
  }
</script>

The above is all the content of this article. I hope that the content of this article will help you study or work. I also hope to support me more!