返回我的学习作业...登陆

我的学习作业

背后捅人刀2019-03-13 22:36:28224
<!DOCTYPE html>
<html dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>微博</title>
    <style media="screen">
      .b1{width:600px;height:160px;border:10px solid pink;margin:0px auto;padding:10px;}
      img{float:left;}
      #text{width:600px;height:100px;border:1px solid #888;margin-top:5px;}
      .b2{float:right;font-size:14px;color:#888;margin-right:5px;}
      span{font-size:13px;}
      #s1,#s2,#s3,#s4,#s5,#s6{float: left;width: 30px;height: 32px;line-height: 32px;padding-left: 26px;}
      #s1{background: url(images/an5.png) no-repeat left center;}
      #s2{background: url(images/an4.png) no-repeat left center;}
      #s3{background: url(images/an3.png) no-repeat left center;}
      #s4{background: url(images/an2.png) no-repeat left center;}
      #s5{background: url(images/an1.png) no-repeat left center;width: 40px;}
      #s6{ margin-left: 158px;margin-right:15px;color: #888; }
      #fb{width: 80px;height: 30px;border: none;background: #ffc09f;color: #fff;border-radius: 5px;}
      #num{font-size:16px;font-weight:bold;}
    </style>
  </head>
  <body>
    <div>
      <img src="./images/12.png" alt="">
      <div>
        还可以输入<span id="num"></span>字
      </div>
      <textarea id="text"></textarea>
      <span id="s1">表情</span>
      <span id="s2">图片</span>
      <span id="s3">视频</span>
      <span id="s4">话题</span>
      <span id="s5">长微博</span>
      <span id="s6">公开</span>
      <input type="button" id="fb" onclick="cc()" value="发布">
    </div>
  </body>
  <script type="text/javascript">
    var text,num,m;
    window.onload=function(){
      text=document.getElementById('text');
      num=document.getElementById('num');
      text.onkeyup=function aa(){
        m=140-text.value.length;
        if(m<0){
          num.style.color="red";
        }else{
          num.style.color="#888";
        }
        num.innerHTML=m;
      }
    }
    function cc(){
      if(m==140){
        alert("你还没有输入");
      }else if(m<0){
        alert("字数太多,发布失败");
      }else{
        alert("发布成功");
      }
    }
  </script>
</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送