有什么难的?你不是都写出来了?
<BODY>
<script language='javascript'>
function test(obj){
//如果选择了订单
if(obj.selectedIndex==2){
         order_no.style.display=""
         year.style.display="none"
//选中了订单, 显示订单下拉菜单order_no, 
//同时隐藏年份下拉菜单year, 应该怎么写代码
}
//否则
else{
         order_no.style.display="none"
         year.style.display=""
alert(obj.value);
//选中了报表, 显示年份下拉菜单year, 
//同时隐藏订单下拉菜单order_no, 应该怎么写代码
}
}
</script><select name='rep' OnChange='test(this);'>
<option value='汇总表' selected>汇总表</option>
<option value='日报表'>日报表</option>
<option value='订单'>订单</option>
</select><select name='year' style='display:none'>
<option selected>2001</option>
<option>2002</option>
<option>2003</option>
</select><select name='order_no' style='display:none'>
<option selected>订单一</option>
<option>订单二</option>
<option>订单三</option>
</select></BODY>

解决方案 »

  1.   

    function test(obj){
    //如果选择了订单
    if(obj.selectedIndex==2){
    //选中了订单, 显示订单下拉菜单order_no, 
    //同时隐藏年份下拉菜单year, 应该怎么写代码
    order_no.style.display = "";
    year.style.display = "none";
    }
    //否则
    if(obj.selectedIndex!=2){
    alert(obj.value);
    //选中了报表, 显示年份下拉菜单year, 
    //同时隐藏订单下拉菜单order_no, 应该怎么写代码
    order_no.style.display = "none";
    year.style.display = "";
    }
    }
      

  2.   

    <BODY>
    <script language='javascript'>
    function test(obj){
    //如果选择了订单
    if(obj.selectedIndex==2){
    //选中了订单, 显示订单下拉菜单order_no, 
    document.all.order_no.style.display='block';
    //同时隐藏年份下拉菜单year, 应该怎么写代码
    document.all.year.style.display='none';
    }
    //否则
    if(obj.selectedIndex!=2){
    alert(obj.value);
    //选中了报表, 显示年份下拉菜单year, 
            document.all.year.style.display='block';
    //同时隐藏订单下拉菜单order_no, 应该怎么写代码
    document.all.order_no.style.display='none';
    }
    }
    </script><select name='rep' OnChange='test(this);'>
    <option value='汇总表' selected>汇总表</option>
    <option value='日报表'>日报表</option>
    <option value='订单'>订单</option>
    </select><select name='year' style='display:block'>
    <option selected>2001</option>
    <option>2002</option>
    <option>2003</option>
    </select><select name='order_no' style='display:block'>
    <option selected>订单一</option>
    <option>订单二</option>
    <option>订单三</option>
    </select></BODY>