<select name="m_servre">
          <option>服务器1</option>
          <option>服务器2</option>
          <option>服务器3</option>
        
          <option>服务器4</option>
        
          </select>  比如我想要在服务器1哪个列表选择服务器1..希望可以在电影地址中的文本value值添加上http:172.13.11.1
选择服务器2..电影地址对应改为http:172.13.11.2
<tr>    
        <td width="30%" height="29">电影地址:</td> 
        <td colspan="2" height="29" width="78%">    
            <input type="text" name="m_address" size="40"  value="??"> 
        </td> 
    </tr>

解决方案 »

  1.   

    <script type="text/javascript">
    var arr = new Array();
    arr[1] = '172.13.11.1';
    arr[2] = '172.13.11.2';
    arr[3] = '172.13.11.3';
    arr[4] = '172.13.11.4';  function changeVal(objSelect) {
    document.getElementById('m_address').value = arr[objSelect.options[objSelect.selectedIndex].value];
    }</script><select id="m_servre" onchange="changeVal(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> 
    <table>
    <tr>    
            <td width="30%" height="29">电影地址:</td> 
            <td colspan="2" height="29" width="78%">    
                <input type="text" id="m_address" size="40"  value="??"> 
            </td> 
        </tr>
    </table>