Posted By

perelin on 07/17/06


Tagged

select list Value


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


setSelectListToValue


 / Published in: JavaScript
 

  1. function setSelectListToValue()
  2. {
  3. var i, si, v, args=setSelectListToValue.arguments;
  4. if ((obj=MM_findObj(args[1])) != null)
  5. {
  6. v = args[0]; // value nach dem gesucht wird
  7. //alert(v);
  8. for(i=0; i<obj.length; i++)
  9. {
  10. // alert(obj.options[i].value+' ist '+i);
  11. if(obj.options[i].value == v)
  12. {
  13. //alert(i);
  14. si = i // Wenn Option value = gesuchter value -> selectedindex speichern
  15. }
  16. }
  17. //alert(obj.length);
  18. obj.selectedIndex = si;
  19. }
  20. }

Report this snippet  

You need to login to post a comment.