zoukankan      html  css  js  c++  java
  • 使用 jquery 制作简单QQ 聊天窗口 制作课工厂简单窗口---------2017-7-1 16:08

    1,制作qq 窗口

    <!DOCTYPE html>
    <html>
      <head>
        <title>QQ聊天工具</title>
    	
        <meta name="keywords" content="keyword1,keyword2,keyword3">
        <meta name="description" content="this is my page">
        <meta name="content-type" content="text/html; charset=gbk">
        
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    	<style type="text/css">
    		*{margin: 0; padding: 0; line-height: 22px; font-family: "Arial", "微软雅黑";}
            #chat{margin: 3px auto 0 auto; 436px; border: 1px #999999 solid;}
            .chatBody{ 100%; height: 220px; overflow:auto;}
            .chatText{border: none;  100%; height: 50px;}
    		.btn{text-align: right;}
    		.btn span{display: inline-block; padding: 0 10px; height: 25px;
       				 overflow: hidden; color: #ffffff; border-radius: 5px; background-color: #069dd5; font-size: 12px; margin-right: 3px; cursor:pointer;}
    		.chatBody div:first-of-type{float: left;  38px;}
    		.chatBody p{float: left; font-size: 12px; 370px; color: #0000ff;}
    		.chatBody div:last-of-type{
    	   			 float: left;  370px; font-size: 12px;}
    		.chatBody section{clear: both;}
    		.chatContent{ background:#efefef;border-radius: 5px; padding: 3px;}
    	</style>
      	<script src="js/jQuery1.11.1.js"></script>
    <script type="text/javascript" src="js/jquery-migrate-1.2.0.js"></script>
    <script type="text/javascript">
    	$(function(){
    		var hadImg=new Array("head01.jpg","head02.jpg","head03.jpg");
    			
    		var uName=new Array("海滩登陆","英雄登场","占领高地");
    		
    		$("#send").click(function(){
    			//判断聊天内容长度》0,显示在上面
    			if($(".chatText").val().length>0){
    				//获取聊天内容
    				var str=$(".chatBody").html();
    				//随机数
    				var tou=Math.floor(Math.random()*3);
    				//获得随机图【片
    				var hedstr="<div><img src='images/"+hadImg[tou]+"'</div>";
    				//获得随机名字
    				var useName="<p>"+uName[tou]+"</p>";
    				
    				//获取当前输入的内容
    				var cha=$(".chatText").val();
    				var chastr="<div>"+cha+"</div>";
    				//把内容放到chatbox里头
    				var suoYou="<section>"+hedstr+useName+chastr+"</section>";
    				//显示在指定位置,清楚内容
    				$(".chatBody").html(str+suoYou);
    				$(".chatBody section div:last").addClass("chatContent");
    				$(".chatText").val("");
    			}
    		});
    	});
    </script>
      </head>
      
      <body>
        <section id="chat">
        	<div class="chatBody"></div>
        	<div><img src="images/icon.jpg"></div>
       	 	<textarea class="chatText"></textarea>
        	<div class="btn"><span>关闭(C)</span><span id="send">发送(S)</span></div>
    </section>
    
        
      </body>
    </html>
    

    2,制作课工厂窗口

    <!DOCTYPE html>
    <html>
      <head>
        <title>课工厂窗口制作</title>
    	
        <meta name="keywords" content="keyword1,keyword2,keyword3">
        <meta name="description" content="this is my page">
        <meta name="content-type" content="text/html; charset=gbk">
        
        <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
        	<style type="text/css">
        		*{margin: 0; padding: 0; font-family: "Arial", "微软雅黑";}
    			ul,li{list-style: none;}
    			.bbs{margin: 0 auto;  600px; position: relative;}
    			header{padding: 5px 0; border-bottom: 1px solid #cecece;}
    			header span{display:inline-block;  220px; height: 50px; color: #fff; background: #009966; font-size: 18px; font-weight: bold; text-align: center;line-height: 50px; border-radius: 8px; cursor: pointer;}
    			.post{position: absolute; background: #ffffff; border: 1px #999999 solid;  500px; left: 65px; top:70px; padding: 10px; font-size: 14px; z-index: 999999; display: none;}
    			.post .title{ 450px; height:30px; line-height: 30px; display: block; border: 1px #aaaaaa solid; margin-bottom: 10px;}
    			.post select{ 200px; height: 30px;}
    			.post .content{ 450px; height: 200px; display: block; margin: 10px 0;border: 1px #aaaaaa solid;}
    			.post .btn{ 160px; height: 35px; color: #fff; background: #009966; border: none; font-size: 14px; font-weight: bold; text-align: center; line-height: 35px; border-radius: 8px; cursor: pointer;}
    
    			.bbs section ul li{padding: 10px 0; border-bottom: 1px #999999 dashed;
       							 overflow: hidden;}
    			.bbs section ul li div{float: left;  60px; margin-right: 10px;}
    			.bbs section ul li div img{ border-radius:50%;  60px;}
    			.bbs section ul li h1{float: left;  520px; font-size: 16px; line-height: 35px;}
    			.bbs section ul li p{color: #666666; line-height: 25px; font-size: 12px; }
    			.bbs section ul li p span{padding-right:20px;}
        	</style>
    	<script src="js/jQuery1.11.1.js"></script>
    	<script type="text/javascript" src="js/jquery-migrate-1.2.0.js"></script>
    	<script type="text/javascript">
    		$(function(){
    			$(".bbs header span").click(function(){
    				$(".post").show();
    				
    			});
    			var headimage=new Array("tou01.jpg","tou02.jpg","tou03.jpg","tou04.jpg");
    			$(".btn").click(function(){
    				//获取标题内容
    				var mytitle=$(".title").val();
    				var tites=$("<div>"+mytitle+"</div>");
    				//获取随,机数得到标题图片
    				var index=Math.floor(Math.random()*4);
    				
    				var imaindex=$("<img src='images/"+headimage[index]+"'></img>");
    				
    				//获取和设置板块发布
    				var myslect=$(".post select").val();
    				var date=new Date();
    				var newdate=date.getFullYear()+"-"+date.getMonth()+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes();
    				var shijian=newdate;
    				var day=$("<p><span>"+myslect+"   "+shijian+"</span></p>");
    				
    				var myli=$("<li></li>");
    				myli.append(imaindex);
    				myli.append(tites);
    				myli.append(day);
    				$("section ul").append(myli);
    				$(".post").hide();
    				
    			});
    		});
    	</script>
      </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>
        
      </body>
    </html>
    

      

  • 相关阅读:
    java基础之二:取整函数(Math类)
    springboot:读取application.yml文件
    java基础之一:基本数据类型
    git操作之四:git branch(本地仓库)
    git操作之三:git reset
    git操作之二:git restore
    git操作之一:git add/commit/init
    Kubernetes 教程:在 Containerd 容器中使用 GPU
    Kubernetes 使用 Kubevirt 运行管理 Windows 10 操作系统
    在 macOS 中使用 Podman
  • 原文地址:https://www.cnblogs.com/bb1008/p/7102674.html
Copyright © 2011-2022 走看看