请教 这个页面如何实现? 在下拉框旁边加个按钮,点击按钮根据下拉框的值在当前页面显示不同的网页内容。
现在是下拉框一改变下面就变化,我想点击按钮后下面再出现,请教如何改写这段代码<HTML><scriptlanguage="javascript">functiona(ob...
现在是下拉框一改变下面就变化,我想点击按钮后下面再出现,请教如何改写这段代码
<HTML>
<script language="javascript">
function a(obj)
{ var _selectedvalue = obj.value;
if(_selectedvalue==''){ _selectedvalue = '-1'; }
for(i=1;i<=4;i++){
var divobj = document.getElementById('tb'+i);
if(parseInt(_selectedvalue)==i){ divobj.style.display = 'block'; }
else{ divobj.style.display = 'none';
}
}
}
</script>
<BODY>下拉:
<select id='selecttb' onchange="a(this)">
<option value=''></option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select>
<div id="tb1" style='display:none'>
<table> <tr><td>1</td></tr> </table> </div>
<div id="tb2" style='display:none'>
<table> <tr><td>2</td></tr> </table> </div>
<div id="tb3" style='display:none'>
<table> <tr><td>3</td></tr> </table> </div>
<div id="tb4" style='display:none'>
<table> <tr><td>4</td></tr> </table> </div>
<table> <tr><td>8</td></tr> </table> </div>
</BODY></HTML> 展开
<HTML>
<script language="javascript">
function a(obj)
{ var _selectedvalue = obj.value;
if(_selectedvalue==''){ _selectedvalue = '-1'; }
for(i=1;i<=4;i++){
var divobj = document.getElementById('tb'+i);
if(parseInt(_selectedvalue)==i){ divobj.style.display = 'block'; }
else{ divobj.style.display = 'none';
}
}
}
</script>
<BODY>下拉:
<select id='selecttb' onchange="a(this)">
<option value=''></option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select>
<div id="tb1" style='display:none'>
<table> <tr><td>1</td></tr> </table> </div>
<div id="tb2" style='display:none'>
<table> <tr><td>2</td></tr> </table> </div>
<div id="tb3" style='display:none'>
<table> <tr><td>3</td></tr> </table> </div>
<div id="tb4" style='display:none'>
<table> <tr><td>4</td></tr> </table> </div>
<table> <tr><td>8</td></tr> </table> </div>
</BODY></HTML> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询