We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

damarev on 07/19/06


Tagged


Versions (?)


Who likes this?

2 people have marked this snippet as a favorite

Leech
shachi


setSelectListToValue


Published in: JavaScript 


  1. function setSelectListToValue(){
  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. //alert(i);
  8. si = i;
  9. }
  10. }
  11. //alert(obj.length);
  12. obj.selectedIndex = si;
  13. }
  14. }

Report this snippet 

You need to login to post a comment.