首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

jsp中在一个text框中输入数据后怎么全部在本页另外一个文本框中显示?

2011-11-27 
jsp中在一个text框中输入数据后如何全部在本页另外一个文本框中显示??比如在text1中先输入A,在本页text2中

jsp中在一个text框中输入数据后如何全部在本页另外一个文本框中显示??
比如在text1中先输入A,在本页text2中显示A。
再在text中输入B,在text2中显示A,B。
而且要求不把数据插入数据库中,具体应该怎么实现呢》???

[解决办法]
用JavaScript处理text1的onchange或者onkeydown等事件
[解决办法]
简单,脚本处理,
<script type= "javascript ">
showText2(){
document.getElementById( "txt2 ") = document.getElementById( "txt2 ") + ", " + document.getElementById( "txt1 ")
}

</script >

<input id= "txt1 " type= "text " onkeyup = "showText2() ">
<input id= "txt2 " type= "text ">


以上你可能需要对“,”进行一下处理,但思路是这样的。你调一下。
[解决办法]
可以用楼上给位仁兄的做法也可以提交显示象这样:
<%
String text=request.getParameter( "text1 ");
%>
<input type= "text " name= "text2 " value= " <%=text%> ">
<form action= " " method= "post " name= "form1 ">
<input type= "text " name= "text1 ">
<input type= "submit " name= "sub ">
</form>

热点排行