jsp查询显示DIV
workflow.jsp页面代码<scripttype="text/javascript">functiontest(){Stringsq_name=request.ge...
workflow.jsp页面代码
<script type="text/javascript">
function test(){
String sq_name=request.getParameter("sq_name");
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
if(rs1.next()){
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
document.getElementById('d').style.display='none';
document.getElementById('e').style.display='none';
var order=rs1.getString("work_order"); //work_order里的值为a到e,与div的id相对应。
document.getElementById(order).style.display='block';
}
}
</script>
<form name="myform" action="workflow.jsp" method="post">
<span>申请人</span>
<input name="sq_name" id="sq_name" type="text" size="15">
<input name="Submit" type="button" class="button" id="Submit" value="查询" onclick="return test()">
</form>
<div id="a" style="display:none"><img src="newpic/1.gif" /></div>
<div id="b" style="display:none"><img src="newpic/2.gif" /></div>
<div id="c" style="display:none"><img src="newpic/3.gif" /></div>
<div id="d" style="display:none"><img src="newpic/4.gif" /></div>
<div id="e" style="display:none"><img src="newpic/5.gif" /></div>
输入名字(sq_name)后,点击查询,在数据库结果集里根据该用户的work_order值显示相应的DIV,现在点查询什么也不显示,也不报错。 展开
<script type="text/javascript">
function test(){
String sq_name=request.getParameter("sq_name");
ResultSet rs1=inBean.ExeQuery("select * from sq_user,work_flow where sq_user.work_name=work_flow.work_name and sq_name='"+sq_name+"'");
if(rs1.next()){
document.getElementById('a').style.display='none';
document.getElementById('b').style.display='none';
document.getElementById('c').style.display='none';
document.getElementById('d').style.display='none';
document.getElementById('e').style.display='none';
var order=rs1.getString("work_order"); //work_order里的值为a到e,与div的id相对应。
document.getElementById(order).style.display='block';
}
}
</script>
<form name="myform" action="workflow.jsp" method="post">
<span>申请人</span>
<input name="sq_name" id="sq_name" type="text" size="15">
<input name="Submit" type="button" class="button" id="Submit" value="查询" onclick="return test()">
</form>
<div id="a" style="display:none"><img src="newpic/1.gif" /></div>
<div id="b" style="display:none"><img src="newpic/2.gif" /></div>
<div id="c" style="display:none"><img src="newpic/3.gif" /></div>
<div id="d" style="display:none"><img src="newpic/4.gif" /></div>
<div id="e" style="display:none"><img src="newpic/5.gif" /></div>
输入名字(sq_name)后,点击查询,在数据库结果集里根据该用户的work_order值显示相应的DIV,现在点查询什么也不显示,也不报错。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询