论坛: 网站建设 标题: js问题,各位进来看看好吗. 复制本贴地址    
作者: DIY [gongguyu]    论坛用户   登录
一框架frame1中有一表单select ,当选择select选项value,从另一隐藏frame2中提取相应的数据显示在指定区域.
主框架
代码:

<html>
<frameset rows="20%,80%">
<frame src="frame1.html" name="a1">
<frame src="frame2.html" name="a2">
</frameset>


文件名:frame1.html
代码:

<html>
<script language="javascript">
function resizeFrame(flag) {
if(flag==1)
  parent.document.body.rows="100%,*";
  else
  parent.document.body.rows="10%,*";
}
function changeList() {
  parent.a2.document.location.href="frame2.htm?type=".+document.forms[0].filter.value;
}
</script>
<body onload="resizeFrame(1);">
<form>
请输入公司信息:<br>
<hr>
名称:<input type="text"><br>
地址:<input type="text"><br>
编号:<input type="text"><br>
<hr>
<select name="filter" onchange="changeList()" style="width:150px;">
<option value="0">请选择公司规模:</option>
<option value="small">小规模:</option>
<option value="large">大规模:</option>
</select><br>
<div id="displayDetail"></div>
</form>
</body>
</html>


文件名:frame2.html
代码:
<html>
<body>
<script language="javascript">
var aLine="";
if(location.search.indexOf('small')>-1) {
aLine+='<select name="detail" id="detail" size="10" style="width:150px;">';
aLine+='<option value="0">0-50</option>';
aLine+='<option value="1">50-100</option>';
aLine+='<select>';
}
else if(location.search.indexOf('large')>-1 {
aLine+='<select name="detail" id="detail" size="10" style="width:150px;">';
aLine+='<option value="0">100-200</option>';
aLine+='<option value="1">200-300</option>';
aLine+='<select>';
}
parent.a1.document.getElementById('displayDetail').innerHTML=aLine;
</script>
</body>
</html>




有哪位大哥能帮忙看一下,哪里有误,在这里谢谢了.


地主 发表时间: 06-12-25 02:25

论坛: 网站建设

20CN网络安全小组版权所有
Copyright © 2000-2010 20CN Security Group. All Rights Reserved.
论坛程序编写:NetDemon

粤ICP备05087286号