Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. **if (document.forms.length > 0) {**
  2.  
  3. // Ensure we get the 'real' form
  4. for (var j=0; j<document.forms.length; j++)
  5. {
  6. if (document.forms[j].action != 'undefined' && document.forms[j].action != '')
  7. {
  8. frm = document.forms[j];
  9. break;
  10. }
  11. }
  12.  
  13. // Find the first usable input field and set focus
  14. if (frm.elements.length > 0)
  15. {
  16. for (var i=0; i < frm.elements.length; i++)
  17. {
  18. elm = frm.elements[i];
  19. if ( canHaveFocus(elm) )
  20. {
  21. elm.focus();
  22. return;
  23. }
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement