<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>论坛列表</title>
<link href="css/bbs.css" rel="stylesheet">
</head>
<body>
<div class="bbs">
<header><span>我要发帖</span></header>
<section>
<ul></ul>
</section>
<div class="post">
<input class="title" placeholder="请输入标题(1-50个字符)">
所属版块:<select><option>请选择版块</option><option>电子书籍</option><option>新课来了</option><option>新手报到</option><option>职业规划</option></select>
<textarea class="content"></textarea>
<input class="btn" value="发布">
</div>
</div>
<script src="js/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(function(){
$(".bbs span").click(function(){
$(".post").show();
});
var tou=new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg")
$(".btn").click(function(){
var flag = window.confirm("是否发布?");
if(flag==true){
var NewLi = $("<li></li>");
var Num = Math.floor(Math.random()*4)
var $touimage = $("<div><img src=images/"+tou[Num]+"></div>");
var $title = $("<h1>"+$(".title").val()+"</h1>");
var Newp = $("<p></p>");
var myDate = new Date();
var currentDate = myDate.getFullYear()+"-"+parseInt(myDate.getMonth()+1)+"-"+myDate.getDate()+" "+myDate.getHours()+":"+myDate.getMinutes();
Newp.append("<span>模版:"+$(".post select").val()+"</span>");
Newp.append("<span>发表时间:"+currentDate+"</span>")
NewLi.append($touimage);
NewLi.append($title);
NewLi.append(Newp);
$(".bbs section ul").prepend(NewLi);
$(".post .content").val("");
$(".post .title").val("");
$(".bbs .post").hide();
}
});
});
</script>
</body>
</html>
————————————————
版权声明:本文为CSDN博主「wj_143633」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/wj_143633/article/details/135560488
01-11
428
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-29
08-29