JavaScript, проверка e-mail адреса

    Date: 11/13/07 (Code WTF)    Keywords: no keywords


    str = document.getElementById('uemail'+id).value;
    var at="@"
    var dot="."
    var lat=str.indexOf(at)
    var lstr=str.length
    var ldot=str.indexOf(dot)
    if (str==null || str=="" || str.indexOf(at)==-1 || str.indexOf(at)==0
    || str.indexOf(at)==lstr || str.indexOf(dot)==-1 || str.indexOf(dot)==0
    || str.indexOf(dot)==lstr || str.indexOf(at,(lat+1))!=-1 || str.substring(lat-1,lat)==dot
    || str.substring(lat+1,ldot).length<1 || str.substring(lat+1,lat+2)==dot
    || str.indexOf(dot,(lat+2))==-1 || str.indexOf(" ")!=-1 || str.substring(ldot+1,lstr).length !=2)
    {
    error_message = error_message + "* Invalid Email\n";
    error = true;
    }

    Source: http://community.livejournal.com/code_wtf/113099.html

« CSS и новое... || Такой себе Replace »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home