Question : HTML dropdownllist

I need a Javascript code that  with the input value will set the dropdown llist.

For example:
lUsing the value"02" to set the list to "UPS 2nd day"
I tryied diferents solution but fail until now.
Thanks,
I
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
select name="XLEW_1_55_1" id="XLEW_1_55_1" size="1" onChange="recalc_onclick('XLEW_1_55_1')" tabindex="29" class='ee168' style=' width:100% '>
    
    
    
    
  
 
Open in New Window Select All Tags: 
HTML PHP
Open in New Window Select All

Answer : HTML dropdownllist

As written though, it doesn't let the user know that they have entered an unexpected value, in which case you might prefer something like this.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
function lookup( val, id ) {
  var sel = document.getElementById( id )
  var found = false
  if ( sel ) { 
    for ( var i = 0; i < sel.options.length; i++ ) {
      if ( sel.options[ i ].value == val ) {
        sel.options[ i ].selected = true
        found = true
        break
      }
    }
    if ( !found ) {
      alert( 'Unexpected/invalid value entered.' )
    }
  } else {
    alert( 'Specified element not found. id="' + id + '"'  )
  }
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us