<td bgcolor="FDF7E8" ><nobr><font color="black">&nbsp;证件类型</nobr></td>
                <td bgcolor="FDF7E8" colspan="3" ><nobr>&nbsp;<select tabindex="10" name="f_cert_type" style=" WIDTH:172pt" tabindex="2.2" onchange="setBirthdayAndAgeByCertidAndType('F')">
                <option value="" >----</option>
                <%
                 cert_typeDefault=Util.toNotNullString(PersonModel.getcert_type());
                %>
                </select></nobr>这个选择的值比如有身份证和其他证件
                  <td valign="top">&nbsp;备&nbsp;&nbsp;&nbsp;&nbsp;注:</td>
                  <td><textarea name="memo" tabindex="5" class="textareaNo3D" rows="2" cols="70" ><%=Util.toNotNullString(AppModel.getMemo())%></textarea></td>
如果选择了其他证件,要在对应的备注信息显示一行字,如“XXXXXX”。请问这个该如何写呢

解决方案 »

  1.   

    <select name="mdep" id="mdep">
      <option value="部门1">部门1</option>
      <option value="部门2">部门2</option>
      <option value="部门3">部门3</option>
    </select>
    <script>var text = document.getElementById('mdep');
    text.onchange = function(){
    alert( text.options[text.options.selectedIndex].value );
    }
    </script>
      

  2.   

    <script>
    function setBirthdayAndAgeByCertidAndType(f,o){
      document.getElementsByName('memo')[0].innerHTML=o.options[o.selectedIndex].text
    }

    </script><td bgcolor="FDF7E8" ><nobr><font color="black">&nbsp;证件类型</nobr></td>
    <td bgcolor="FDF7E8" colspan="3" ><nobr>&nbsp;
    <select tabindex="10" name="f_cert_type" style=" WIDTH:172pt" tabindex="2.2" onchange="setBirthdayAndAgeByCertidAndType('F',this)">
    <option value="" >----</option>
                    <%
                        cert_typeDefault=Util.toNotNullString(PersonModel.getcert_type());
                    %>
                    </select></nobr>
      

  3.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>test</title>
    <script src="jquery-1.3.2.js"></script>
    <script>
    $(function(){
    $("#select").change(function(){
         var txt = $("#select option:selected").text();
     $("#textareaNo3D").html(txt);// = txt;
    });
    });
    </script>
    </head><body>
    <select id="select">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
    </select><textarea name="memo" tabindex="5" id="textareaNo3D" class="textareaNo3D" rows="2" cols="70"></textarea>
    </body>
    </html>
    这个demo看看,就是传值,如果你要从这个来得到相应的文本也可以