当前页面: 开发资料首页 → JSP 专题 → 请各位帮我看看哪里有问题!运行没有错误,可是就是不显示结果!(急死了!)
请各位帮我看看哪里有问题!运行没有错误,可是就是不显示结果!(急死了!)
摘要: 请各位帮我看看哪里有问题!运行没有错误,可是就是不显示结果!(急死了!)
<script LANGUAGE=JavaScript>
function hide(var s) {
document.getElementById(s).style.display = "none";
}
function show(var s) {
document.getElementById(s).style.display = "block";
}
</script>
。。。
<select class=input name='s1' id='s1'>
<option value="1" onClick="hide('flight5');show('flight4');">按航班号</option>
<option value="2" onClick="hide('flight4');show('flight5');">按城市</option>
</select>
。。。
<table width="100%">
。。。
</table>
<table width="100%">
。。。
</table>
我是想实现当选择“按航班号”时显示“flight4”,选择“按城市”时,显示“flight5”。
用一个层去实现
whzresponse() :您能说明白点么?
select 的 option项没有onclick函数,而是select本身有onchange函数 这一点你要明白
用
object.style.visibility="visible" or "hidden"
来替换object.style.display = "none" or "block"
就可以实现你要求的效果.我就是这样实现的
<script language=JavaScript>
function hide(s) {
document.getElementById(s).style.display = "none";
}
function show(s) {
document.getElementById(s).style.display = "block";
}
function changeValue(value1){
if(parseInt(value1)==1){
hide('flight5');
show('flight4');
}else if(parseInt(value1)==2){
hide('flight4');
show('flight5');
}
}
</script>
<head></head>
<body>
<select name='s1' id='s1' onchange="changeValue(this.options[selectedIndex].value)">
<option value="1" >按航班号</option>
<option value="2" >按城市</option>
</select>
<table width="100%">
</table>
<table width="100%">
</table>
</body>
谢谢各位!