zoukankan      html  css  js  c++  java
  • 论坛

      <!DOCTYPE html>
      <html>
      <head lang="en">
      <meta charset="UTF-8">
      <title>课工场论坛列表</title>
      <link href="css/bbs.css" rel="stylesheet">
      <script>
      function fa() {
      document.getElementById("post1").style.display="block";
      //alert("aaa");
       
      }
      function touxiang () {
      let tou = new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg");
      let suiji =parseInt(Math.random()*4);
      return tou[suiji];
      }
      function chu() {
      document.getElementById("post1").style.display="none";
      let s =document.getElementsByTagName("ul")[0];
      let a =document.createElement("li");
      let b =document.createElement("div");
      let c =document.createElement("img");
      let d =document.createElement("h1");
      let e =document.createElement("p");
      let f =document.createElement("span");
      s.appendChild(a);
      a.className=".bbs section ul li";
      a.appendChild(b);
      b.className = ".bbs section ul li div";
      b.appendChild(c);
      c.className = ".bbs section ul li div img";
      c.src = "images/" + touxiang();
      a.appendChild(d);
      d.className = ".bbs section ul li h1";
      d.innerHTML = document.getElementById("title").value;
      a.appendChild(e);
      e.className = ".bbs section ul li p";
      e.innerHTML = "版块:" + document.getElementsByTagName("select")[0].value;
      e.appendChild(f);
      f.className = ".bbs section ul li p span";
       
      /* let title = document.getElementById("title")[0].value;
      let Block =document.getElementsByTagName("select")[0].value;
      let content =document.getElementsByClassName("content")[0].value;*/
       
      let myDate =new Date();
      let Time = myDate.getFullYear() + "-" + (myDate.getMonth()+1)+ "-" + myDate.getDate() + " " + myDate.getHours() + ":" + myDate.getMinutes();
      f.innerHTML = "发表时间:" + Time;
      // alert(Time);
       
      document.getElementById("title").value = "";
      document.getElementsByTagName("select")[0].value = "";
      //document.genElementById("content").value="";
      document.getElementsByClassName("content")[0].value="";
      s.insertBefore(a, s.firstElementChild);
       
       
       
      }
       
       
       
      </script>
      </head>
      <body>
      <div class="bbs">
      <header><span onclick="fa()">我要发帖</span></header>
      <section>
      <ul></ul>
      </section>
       
       
      <div class="post" id="post1">
      <input class="title" id="title" placeholder="请输入标题(1-50个字符)">
      所属版块:<select id="Block"><option>请选择版块</option><option>电子书籍</option><option>新课来了</option><option>新手报到</option><option>职业规划</option></select>
      <textarea class="content" id="content"></textarea>
       
      <input class="btn" value="发布" onclick="chu()">
      </div>
      </div>
       
       
       
      </body>
      </html>
  • 相关阅读:
    【19】网站搭建:标签功能
    【18】网站搭建:自定义用户模型
    【17】网站搭建:Celery定时刷新缓存
    【16】网站搭建:Redis缓存提速
    【15】网站搭建:用户注册登录
    【14】网站搭建:xadmin后台强化
    【13】网站搭建:全文搜索
    C#,一种简单的方式实现滚动鼠标缩放图片,平移
    WebGIS的开发方式
    C#中找不到MouseWheel事件的解决办法
  • 原文地址:https://www.cnblogs.com/9797ch/p/11360583.html
Copyright © 2011-2022 走看看