怎么使这个页面按可选的不同值转向三个不同的相应页面,用javascript会使对文本的输入处理的jsp脚本给忽略了,直接转向页面了,应该怎么使表单提交之前仍然可以处理文本内容?希望给个小小的例子.
解决方案 »
- 我想删除qymchzgds中的某个对象怎么处理,请教了
- 关于jprofiler在unix中连接问题
- 如何用JSP实现树形图???
- 如果action的时候from加入ENCTYPE="multipart/form-data"!!!关于文件上传啊!
- 表格可填写行的增加问题!
- 谁能推荐几种B/S的图表统计组件(java)?
- 我的Tomcat地址是http://aaa:8080/project/ 如何将8080去掉!!万分火急!多谢!
- 关于BEANS引起的汉字问题,求救!!再次帖出
- 使用ORACLE的JDBC驱动该怎么配置?
- 请教Struts2的action问题!
- 累加时间的问题
- 在是struts中 如何在打开jsp页面时候自动运行javabean进行程序处理???
<script>
function fff()
{
if(选择1)
{document.form1.action="页面1";}
if(选择2)
{document.form1.action="页面2";}
if(选择3)
{document.form1.action="页面3";}
document.form1.submit;
}
</script>
<form name="form1" action="">
<input type="text" name="t1"/>
<input type="text" name="t2"/>
<radio name="ra" value="1">
<radio name="ra" value="2">
<radio name="ra" value="3">
<input typ="button" onclick="fff()"/>
</form>
function goto()
{
f = document.form1;
for(c=0;c<f.type.length;c++)
{
if(f.type[0].checked&&document.all("name").value!=""&&document.all("name").value!="")
{
f.action="../student/student_info.jsp?id="+document.all("id").value;
}
if(f.type[1].checked&&document.all("name").value!=""&&document.all("name").value!="")
{
f.action="../teacher/teacher_info.jsp";
}
if(f.type[2].checked&&document.all("name").value!=""&&document.all("name").value!="")
{
f.action="../admin/admin_info.jsp";
}
}
document.form1.submit();
}
</script>
<form method=post action="" name=form1 >
<input type=radio value="1" name=type checked>学生
<input type=radio value="2" name=type >教师
<input type=radio value="3" name=type >管理员
<%
String id="";
String type=request.getParameter("type");
String name=request.getParameter("name");
String password=request.getParameter("password");
if(name==null||type==null||password==null)
{}
else if(name==""||type==""||password=="")
{
%>
<script>
alert('输入不能为空');
</script>
<%
}
else
{
if(!login.checkLogin())
{
out.println("您没有注册或是输入有误");
}
else
{
id=login.get_IDbyname();
}
}
%>
<input type=hidden name=id value=<%=id%> />
<input name=b1 type=submit class=button value="登陆" onClick="goto()"/>
<input type=reset class=button value="重置"/>
</form>
就这些,如果按自己写的方法的话,转向的时候根本不能读,系统没有输出...