MyException - 我的异常网
当前位置:我的异常网» Java Web开发 » 同一个页面中值传递的有关问题

同一个页面中值传递的有关问题

www.MyException.Cn  网友分享于:2013-12-05  浏览:32次
求教:同一个页面中值传递的问题
在一个页面需要实现如下的功能:
通过选择下拉框来选中某一个值,然后降值自动传递给相同页面中的其他参数来完成相应的功能,该怎么实现呢?

------解决方案--------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
</HEAD>
<script language=JavaScript>
function passvalue(){
for(var i=0;i <document.testdata.testvalue.options.length;i++)
{
if (document.testdata.testvalue.options[i].selected==true)
{
document.testdata.inputdata.value=document.testdata.testvalue.options[i].value;
}
}
}
</script>
<BODY>
<form name= "testdata ">
<select name= "testvalue " onchange= "passvalue() ">
<option value=1> test1 </option>
<option value=2> test2 </option>
<option value=3> test3 </option>
</select>
<input type=text name= "inputdata ">
</form>
</BODY>
</HTML>
用onchange不会刷新啊
------解决方案--------------------
<%
String name2 = request.getParameter( "name ");
if(name2 != null && ! " ".equals(name2))
{
do something for name2
}
%>
<form name= "formname " method= "post " action= "***.jsp " >
<table align= "center " border= "0 " cellpadding= "0 " cellspacing= "1 " >
<tr>
<td> 姓名:
<%
if(name2 != null && ! " ".equals(name2))
{

%>
<input name= "name " type= "text " value= ' <%=name2 %> '
onBlur= "javascript:if(document.all.formname.name.value != ' ')
{document.formname.action= ' ';document.formname.submit();}else alert
( 'please input '); ">
</td>
<%
}
else
{
%>
<input name= "injure_name " type= "text " value= ' ' onBlur= "javascript:if
(document.all.formname.name.value != ' ')
{document.formname.action= ' ';document.formname.submit();}else alert
( 'please input '); " ">
</td>
<%
}
%>
</tr>
</table>
------解决方案--------------------
<html:html locale= "true ">
<head>
<html:base />

<title> telAdd.jsp </title>
<link rel= "stylesheet " href= "css/aa.css " type= "text/css ">
<meta http-equiv= "content-type " content= "text/html; charset=UTF-8 "/>

<!--
<link rel= "stylesheet " type= "text/css " href= "styles.css ">
-->
<script language= "JavaScript ">


function getDept(com)

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有