zoukankan      html  css  js  c++  java
  • 网络聊天室

    //chatroom.jsp;

    <html style="height: 93px; ">
    <head>
    <title>网络聊天室</title>
    </head>
    <frameset rows="*,150">
    <frame src="message.jsp">
    <frame src="talk.jsp">
    </frameset>
    </html>

    //message.jsp

    <%@page contentType="text/html" pageEncoding="UTF-8" %>
    <html>
    <head>
    <meta http-equiv="REFRESH" content="1;url=message.jsp">
    <script LANGUAGE="JavaScript1.1">
    function scrollWindow()
    {
    this.scroll(0,65000);
    setTimeout('scrollWindow()',200);
    }
    scrollWindow();
    </script>
    </head>
    <body>
    <%=application.getAttribute("words") %>
    </body>
    </html>

    //talk.jsp

    <%@page contentType="text/html" pageEncoding="UTF-8" %>
    <%
    request.setCharacterEncoding("utf-8"); 
    String mywords=request.getParameter("message");
    application.log(mywords);
    if(mywords!=null)
    {
    int len_mywords=mywords.length();
    int flag=1;
    application.log(""+len_mywords);
    for(int i=0;i<(len_mywords);i++)
    {
    if(mywords.charAt(i)=='<')
    {
    flag=0;
    }
    }

    if(flag==1)
    {
    mywords=">>:"+mywords;
    Object obj=application.getAttribute("words");
    if(obj==null)
    {
    application.setAttribute("words",mywords);
    }
    else
    {
    application.setAttribute("words",obj.toString()+mywords+"<br>");
    }
    }
    }%>
    <html>
    <head> 
    <title></title>
    </head>

    <body>
    <form method="post" action="talk.jsp">
    <input name="message"type=text size=50>
    <input type=submit value=send>
    </form>
    </body>
    </html>

  • 相关阅读:
    P1428 小鱼比可爱
    P5727 【深基5.例3】冰雹猜想
    P1427 小鱼的数字游戏
    P1047 [NOIP2005 普及组] 校门外的树
    P5729 工艺品制作
    P5728 【深基5.例5】旗鼓相当的对手
    CodeSmith使用和语法简介
    系统缓存
    FLV视频转换的利器 ffmpeg.exe
    Vs.Net方向将Excel数据导入到数据库
  • 原文地址:https://www.cnblogs.com/liao-pxsoftware15/p/7679381.html
Copyright © 2011-2022 走看看