作业 1.14

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>论坛列表</title>
	</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 src="js/bbs.js">
			$(function(){
				var tou=new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg");
				$(".bbs header span").click(function(){
					$(".bbs.post").show();
				});
				$(".post.btn").click(function(){
					var flag = window.confirm("是否发布?");
					if(flag==true){
						var $newLi = $("<li></li>");
						var iNum = Math.floor(Math.random()*4)
						var $touImage = $("<div>< img src=images/"+tou[iNum]+"/></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.getDate()+"-"+myDate.getHours()+"-"+myDate.getMinutes();
						$newP.append("<span>模版:"+$(".post select").val()+"</span>")
						$newP.append("<span>发表时间:"+currentDate+"</span>")
						$newLi.append($touImage);
						$newLi.append($tite);
						$newLi.append($newP);
						$(".bbs section ul").prepend($newLi);
						$(".post .content").val("");
						$(".post .title").val("");
						$(".bbs .post").hide();
					}
				});
			});
		</script>
	</body>
</html>

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值