读书人

刚看过自己两年前写的js 懵了

发布时间: 2012-07-25 09:43:05 作者: rapoo

刚刚看过自己两年前写的js , 懵了。
刚刚看过自己两年前写的js , 懵了。 那个时候 , 对js基本一窍不通, 刚开始工作, 月薪1.7k , leader要求写一个js , 就写了一个这么模模糊糊的js。

function check(){        var xing = document.frm.name.value;        var ming = document.frm.name_c.value;        var email = document.frm.email.value;        var email2=document.frm.c_email.value;        var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;        var tel = document.frm.tel.value;        var school = document.frm.school.value;        var special = document.frm.special.value;        var major = document.frm.major.value;        if(xing =="" || ming ==""){        alert("please input name");        return false;        }        if(email =="" || email2 == "" || email !=email2 || !myreg.test(email)){        alert("please input email");        return false;        }        if(tel == ""){        alert("please input tel!");        return false;        }        for(i=0;i<tel.length;i++){        if(tel.charAt(i)<'0' || tel.charAt(i) > '9'){        alert("tel must be number!");        return false;        break;        }        }        if(tel.length !=11){        alert("tel number must be 11 ")        return false;        }        if(school =="" || special =="" || major == ""){        alert("please input school or speciality or special");        return false;        }        return true;}


现在看起来, 那时候相当的菜, 不过,那时候最起码感觉不到自己的无知,感觉到的是弱小, 现在却越来越感觉不会, 不知道的更多。 自己不但无知,而且更菜。 无知不可怕,可怕是感觉不到自己的无知。

让自己懂点吧。稍微懂点吧。 那就看书吧 , 实践吧。

读书人网 >JavaScript

热点推荐