Posted By

damarev on 10/10/06


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

luman


set Select List To Value


 / Published in: JavaScript
 

  1. function setSelectListToValue(value, selectId){
  2. var i, si, v, args=setSelectListToValue.arguments;
  3. if ((obj=document.getElementById(args[1])) != null){
  4. v = args[0];
  5. for(i=0; i<obj.length; i++){
  6. if(obj.options[i].value == v){
  7. si = i;
  8. }
  9. }
  10. obj.selectedIndex = si;
  11. }
  12. }

Report this snippet  

You need to login to post a comment.