现在有三个按钮:t1,t2,t3和一个下拉列表框(值t1,t2,t3),需要有一段代码实现这样的到作:当选择按钮t2时,下拉列表框值也相应为t2,选择t3按钮时下拉列表框值为t3,
谁有这样的程序代码或那位帮我写,谢谢啦!

解决方案 »

  1.   

    这么简单的。。不会写
    <input type="button" name="t1" onclick="document.下拉框的名字.value='t1'">
    <input type="button" name="t2" onclick="document.下拉框的名字.value='t2'">
    <input type="button" name="t3" onclick="document.下拉框的名字.value='t3'">
    这个样子不知道行不行哦.
      

  2.   

    <select name="aaa">
    <option value="t1">t1
    <option value="t2">t2
    <option value="t3">t3
    </select>
    <input type="button" name="t1" onclick="document.all('aaa').value='t1'">
    <input type="button" name="t2" onclick="document.all('aaa').value='t2'">
    <input type="button" name="t3" onclick="document.all('aaa').value='t3'">
      

  3.   

    <select name="aa">
      <option value="t1">t1</option>
      <option value="t2">t2</option>
      <option value="t3">t3</option>
    </select>
    <input name="t1" type="button" value="t1" onclick="document.all.aa.value='t1'">
    <input name="t2" type="button" value="t2" onclick="document.all.aa.value='t2'">
    <input name="t3" type="button" value="t3" onclick="document.all.aa.value='t3'">
      

  4.   

    下拉列表代码以下,和t1,t2,t3值包含在其中,
    <tr>
    <td class="tdTitle"><%=ResourcesFactory.getString("process_orgpolicy.typeid")%>:</td>
    <td class="tdRight">
    <html:select name="typeid"  property="typeid" size="1" style="width:100">
    <<html:options  collection="restypeoptions" property="itemid" labelProperty="itemname"/>
    html:select>
    </td>
    </tr>
    按钮t1,t2,t3包含在typevalue中
    <%
       String typevalue =(String)session.getAttribute("typeid");
        if (typevalue==null){
        typevalue="";
       }
     
    %>
    那又怎么样当选择按钮t2时,下拉列表框值也相应为t2,选择t3按钮时下拉列表框值为t3,
    谁有这样的程序代码或那位帮我写,谢谢啦!