添加用户名输入时的键盘事件,当输入时按下每个键时会激发index.addAq函数,传入html id和键值,输入完成时index.reportAq(this)提交键盘事件记录的数据:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | $.e.add($( 'nick' ), 'keydown' , function (a) { index.current_error_dom = 'nick_keydown_start' ; a = a.keyCode; index.nickExceed = $.str.getBytes( this .value) == 24 && a != index.keyCode.DEL && a != index.keyCode.BACK ? true : false ; index.addAq( this .id, a); index.current_error_dom = 'nick_keydown_end' }); $.e.add($( 'nick' ), 'blur' , function () { index.current_error_dom = 'nick_blur_start' ; $( 'nick_bg' ).className = 'bg_txt' ; if (!index.isChangingTab() && (index.hideInfo( 'nick_info' ), index.chkNick())) { var a = indexType2RegType(index.type); index.ajaxChkNick($( 'nick' ).value, a) } index.reportAq( this ); index.current_error_dom = 'nick_blur_end' }); |
addAq函数将键值和id对应的aq_input对象值和时间保存至数组aq_array:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | aq_input: { nick: 1, phone_num: 2, self_email: 3, other_email: 4, password: 5, password_again: 6, sex_1: 7, sex_2: 8, birthday_type_value: 9, year_value: 10, month_value: 11, day_value: 12, country_value: 13, province_value: 14, city_value: 15, code: 16 }, //a为html id,b为键盘值或固定值, addAq: function (a, b) { var c = ( new Date).getTime(); index.aq_array.push(b + '|' + index.aq_input[a] + '|' + c) }, |
reportAq组合index.aq_array内的数据并提交:
1 2 3 4 5 6 | reportAq: function (a) { var b = new Image; index.aq_array.length == 0 && index.addAq(a.id, 0); a = index.aq_cgi + index.aq_array.join( '&' ); b.src = a }, |
标签:none