1. JavaScript / Говнокод #6961

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    // Checks if the passed input's value is nothing. 
    function isEmptyText(theField) 
    {     
    // Copy the value so changes can be made..     
    var theValue = theField.value;       
    // Strip whitespace off the left side.     
    while (theValue.length > 0 && (theValue.charAt(0) == ' ' || theValue.charAt(0) == '\t'))
            theValue = theValue.substring(1, theValue.length);
         // Strip whitespace off the right side.
         while (theValue.length > 0 && (theValue.charAt(theValue.length - 1) == ' ' || theValue.charAt(theValue.length - 1) == '\t'))
            theValue = theValue.substring(0, theValue.length - 1);
           if (theValue == '')
            return true;
         else
            return false;
      }
    ...
    function in_array(variable, theArray) 
    {
         for (var i in theArray)
            if (theArray == variable)
               return true;
           return false;
    }

    Запостил: zomg, 16 Июня 2011

    Комментарии (5) RSS

    Добавить комментарий