隐藏祯来实现。
在你要实现的页面隐藏一个<iframe>
捕捉下拉框的onchange事件,改变<iframe>的src,把公司号传进去。
<iframe>的src里写上从后台查数据的方法。
比如:
src = "readData.jsp?com_id = " + 选的公司号;
在<iframe>取得值,返回到主窗口就行了。
在你要实现的页面隐藏一个<iframe>
捕捉下拉框的onchange事件,改变<iframe>的src,把公司号传进去。
<iframe>的src里写上从后台查数据的方法。
比如:
src = "readData.jsp?com_id = " + 选的公司号;
在<iframe>取得值,返回到主窗口就行了。
解决方案 »
- jsp 转发 新页面
- 还是jstl的问题
- html页面显示于隐藏 请教
- hibernate监测模块(请高手指点)
- 高手帮忙,jsp如何实现打印
- 怎么添加链接?~~
- JSP分页中的 可以跳到指定页码的程序??可是有错!
- 页面标签的问题,很头疼,帮忙看看......
- 有谁用过jrun4吗?十分恼怒,真拿它没办法,急死了!
- 一个关于request.getCharacterEncoding()的问题,大家帮忙!
- 请问我有一个连接cn 如果我在对它操作以后不关闭它会有什么影响吗?想法是一个页面有二个提交,想公用一个连接。
- 将时间格式化成"YYYY-MM-DD hh:mm:ss”,但要求返回结果仍为事件类型?
<html>
<head>
<title>二级关联下拉框</title>
</head><br><br><form name="doublecombo"><select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>应用技术开发网站</option>
<option>国内JavaScript技术网站</option>
<option>国外的著名搜索引擎</option>
</select>
<select name="stage2" size="1">
<option value="http://www.80cn.com">世纪鸟作坊</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("世纪鸟作坊","http://www.80cn.com")
group[1][0]=new Option("万旭JavaScript仓库","http://www.wanxu.com")
group[1][1]=new Option("JavaScript2000","http://www.javascript2000.com")
group[1][2]=new Option("无忧脚本","http://www.51js.com")
group[2][0]=new Option("Hotbot","http://www.hotbot.com")
group[2][1]=new Option("Infoseek","http://www.infoseek.com")
group[2][2]=new Option("Excite","http://www.excite.com")
group[2][3]=new Option("Lycos","http://www.lycos.com")
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
</br></br>
<script language="JavaScript">
document.form1.DEP_ID.attachEvent //DEP_ID是select控件("onchange",readEmployeeId);
</script>
<script language="JavaScript">
function readEmployeeId() { prodObj = window.event.srcElement;
if ( prodObj == null ) return;
var sIndex = document.form1.DEP_ID.selectedIndex;
if ( sIndex <= 0 ) sIndex = 0;
var dep_id=document.form1.DEP_ID.options[sIndex].value;
jsp = "readEmployeeId.jsp?DEP_ID=";
url = jsp + dep_id;
var f = document.getElementById("dataFrame");
f.src = url;
}
function fillData(prodEmployeeId) {
if (prodObj == null) return;
document.getElementById("EMPLOYEE_ID").innerHTML = prodEmployeeId; //EMPLOYEE_ID是select控件
prodObj = null;
}
</script>
<iframe style="display:none" id="dataFrame"></iframe>
readEmployeeId.jsp:联接数据库根据部门信息查出人员信息
<html>
<head>
</head>
<body>
<%
String employee = "";
String node_id = request.getParameter("DEP_ID");
employeeid = //从数据库取出的值
%>
<script language="JavaScript">var prodEmployeeId = '<%=employee%>';
parent.fillData(prodEmployeeId); </script>
</body>
</html>
隐藏祯如何实现有例子吗?谢谢
readEmployeeId.jsp怎么写就看你自己。
employeeid = //从数据库取出的值——这里就是组成select语句的字符串!!
其实你要从数据库里取数据,肯定要提交出去,这样做只是不把整个页面都提交,只提交一个隐藏桢,思路就是这样,具体的写就靠你自己了。
你得先说说出了什么问题。
调试的时候不要把桢隐藏掉。把style="display:none"去掉。
看看数据查出来没。
style="display:none"变成style="display:block",这样可以在里面看到出错信息
<%@ page contentType="text/html; charset=gb2312" %><%@ page import="java.sql.*"%>
<script language="JavaScript">
document.form1.DEP_ID.attachEvent("onChange",readEmployeeId); </script><script language="JavaScript">
function readEmployeeId() {
prodObj = window.event.srcElement;
if ( prodObj == null ) return;
var sIndex = document.form1.DEP_ID.selectedIndex;
if ( sIndex <= 0 ) sIndex = 0;
var dep_id=document.form1.DEP_ID.options[sIndex].value;
jsp = "read.jsp?tjbm=";
url = jsp + dep_id;
var f = document.getElementById("dataFrame");
f.src = url;
}function fillData(prodEmployeeId) {
if (prodObj == null) return;
document.getElementById("EMPLOYEE_ID").innerHTML = prodEmployeeId; //EMPLOYEE_IDÊÇselect¿Ø¼þ
prodObj = null;
}
</script><iframe style="display:block" id="dataFrame"></iframe>
<html><head>
</head><body>
<form name="form1" method="POST" >
<select name="DEP_ID">
<option>ÇëÑ¡Ôñµ¥Î»</option>
<%
String sqltext = "select distinct dw from dwxx";
ResultSet rs2 = mysd.executeQuery(sqltext);
while(rs2.next()){
%>
<option><%=rs2.getString("dw")%></option>
<%
}
rs2.close();
%>
</select>
<select name="EMPLOYEE_ID">
<option></option>
</select></form>
</body></html>
数据查出来了?
往主页面上写的时候出错了?
你倒是把错误写出来啊。你不写那鸟( season_fly(一望无际的鸟) )怎么知道呢?