求帮忙解释一段验证
这段JS验证代码,那位能帮忙解释一下啊?程序代码:
<script type="text/javascript" reload="1"> var pagescroll = new pagescroll_class('floatlayout_register', 600, 400); $('floatlayout_register').scrollLeft = 600; document.body.focus(); try { $('username').focus(); } catch(e) {} var profile_username_toolong = '用户名超过 15 个字符'; var profile_username_tooshort = '用户名小于3个字符'; var doublee = parseInt('1'); var lastusername = lastpassword = lastemail = lastinvitecode = ''; function messagehandle_register(key, msg) { $('returnmessage4').className = key == 1 ? 'onerror' : ''; $('returnmessage4').innerHTML = msg; } function checkusername() { var username = trim($('username').value); if(username == '' || username == lastusername) { return; } else { lastusername = username; } var unlen = username.replace(/[^\x00-\xff]/g, "**").length; if(unlen < 3 || unlen > 15) { messagehandle_register(1, unlen < 3 ? profile_username_tooshort : profile_username_toolong); return; } ajaxget('ajax.php?infloat=register&handlekey=register&action=checkusername&username=' + (is_ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username), 'returnmessage4'); } function checkemail() { var email = trim($('email').value); if(email == '' || email == lastemail) { return; } else { lastemail = email; } ajaxget('ajax.php?infloat=register&handlekey=register&action=checkemail&email=' + email, 'returnmessage4'); } function checkinvitecode() { var invitecode = trim($('invitecode').value); if(invitecode == lastinvitecode) { return; } else { lastinvitecode = invitecode; } ajaxget('ajax.php?infloat=register&handlekey=register&action=checkinvitecode&invitecode=' + invitecode, 'returnmessage4'); } function trim(str) { return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1'); } </script>