| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1674 人关注过本帖
标题:如何在<textarea>里换行和清屏
只看楼主 加入收藏
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:10 
如何在<textarea>里换行和清屏
liuyan_index.asp
<html>
<head>
<title>欢迎光临小型聊天室</title>
<meta http-equiv=Content-Language content=zh-cn>

</head>
<body topmargin=100 bgcolor=ffffff>
<table border=1 cellpadding=0 cellspacing=0 width="500">
  <tr>
    <td align="center">聊天室用户登陆</td>
     </tr>
</table>

      <form method=POST action="liuyan_chat.asp">
        <table border=0 cellpadding=0 cellspacing=0 width="500">
           <tr align="center">
                   <td>
         用户名:
                           <input type="text" name="username" size=19 maxlength="10"><br>
          密码:<input type="passWord" name="password" size=19 maxlength="10"><br>
           <input type=submit value="登陆" name="submit">
                      <input type=reset value="重写" name="reset">
           </td>
          </tr>
        </table>
      </form>
</body>
</html>
liuyan_chat.asp
<%
name=request.form("username")
password=request.form("password")
session("sname")=name
if name=""then
response.redirect"liuyan_index.asp"
end if
%>
<html>
<head><title>聊天室</title></head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<frameset rows="500,*">
<frame name="liuyan_show" src="liuyan_show.asp">
<frame name="liuyan_input" src="liuyan_input.asp">
</frameset>
</html>
liuyan_input.asp
<html>
<head>
<title>欢迎光临小型聊天室</title>
<script language="javascript">
 function  OnShow()
 {
     if(form1.putword.value==""){
      alert("请输入内容");
      form1.putword.focus;
      return false;
     }
     return true;
 }
</script>
</head>
<body>
<center>
<meta http-equiv=Content-Language content=zh-cn>
<form method="post" action="liuyan_show.asp" target="liuyan_show" name="form1" onSubmit="return OnShow()">
<p><font=ffff00><input name="uuu" type="text" value="<%=Session("sname")%>" size="5"></font>
说:<input name="putword" type="text">
<input type="submit" name=formsubmit value="发送">
<input type="reset" name=formreset value="重发">
<input type="submit" name="button" value="清屏">
</font>
</form>
</center>
</body>
</html>
liuyan_show.asp
<%
 mytalk=trim(request.form("putword"))
if mytalk<>""then
application.lock
'application("show")=Session("sname")&":"&mytalk&application("show")
'application("show")=Session("sname")&":"&mytalk&application("show")&vbCrlf&""
application("show")=Session("sname")&":"&mytalk&vbCrlf&application("show")
application.unlock
else
  'if mytalk="" Then
  'response.Write("<script>alert("qingshuruneirong")")
  'Response.Write( " <script   language= 'javascript '> alert( 'ad '); </script")
 application("show")=""
end if
%>

<html>
<head>
<title>欢迎光临小型聊天室</title>
</head>
<body>
<center>
<pre>
<meta http-equiv=Content-Language content=zh-cn>
<textarea name="textarea" id="textarea" cols="50" readonly="readonly" rows="20">
<%=application("show")%></textarea>
</pre>
</center>
</body>
</html>

清屏一个在前台,一个在后台,点清屏时连带着吧putword 也提交了






[ 本帖最后由 a768841969 于 2011-4-13 11:14 编辑 ]
搜索更多相关主题的帖子: content 聊天室 ffffff 用户 
2011-04-11 14:51
twtrwr
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:39
专家分:102
注 册:2011-3-31
收藏
得分:10 
在<%=application("show")%>后加<br/>

男人无所畏惧,应越战越勇
2011-04-11 19:01
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
收藏
得分:0 
没有反应
2011-04-12 08:14
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:10 
改成 application("show")=Session("sname")&":"&mytalk&application("show")&vbCrlf&""

----我怎能在别人的苦难面前转过脸去----
2011-04-12 08:39
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
收藏
得分:0 
还是不行,我觉得<textarea>显示的有问题,是不是要用js控制一下呢?具体怎么控制我就不会了
2011-04-12 08:50
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
受你的误导,搞错了,应该是application("show")=Session("sname")&":"&mytalk&vbCrlf&application("show")

要清空表单,你将application("show")="",再刷新liuyan_show.asp这个页面就没有了呀,代码自己发挥


 

----我怎能在别人的苦难面前转过脸去----
2011-04-12 22:11
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
收藏
得分:0 

我是无辜的
2011-04-13 09:16
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
收藏
得分:0 
真的行了谢谢
2011-04-13 09:19
a768841969
Rank: 2
等 级:论坛游民
帖 子:93
专家分:45
注 册:2011-3-31
收藏
得分:0 
清屏不知道这么弄  求帮忙
2011-04-13 11:10
dzt0001
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:5
帖 子:1281
专家分:4998
注 册:2005-10-12
收藏
得分:0 
我都给你提示了,非得全部写出来。幸好今天有空

在liuyan_show.asp最前面添加
<%
if Trim(Request.QueryString("menu"))="clear" then
application("show")=""
end if
%>

liuyan_input.asp加一个链接
<a href="liuyan_show.asp?menu=clear" target="liuyan_show">清屏</a>
 

----我怎能在别人的苦难面前转过脸去----
2011-04-13 12:55
快速回复:如何在<textarea>里换行和清屏
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016496 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved