Posted By


perelin on 07/17/06

Tagged


Statistics


Viewed 552 times
Favorited by 1 user(s)

setSelectListToValue


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.