首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

一个很棒的相仿 Facebook 风格的 TextboxList

2012-10-08 
一个很棒的类似 Facebook 风格的 TextboxListTypeHere.keyup(function (e) {switch (e.keyCode) {case 188

一个很棒的类似 Facebook 风格的 TextboxList

TypeHere.keyup(function (e) {     switch (e.keyCode) {         case 188: // ','            var myInputLength = TypeHere.val().length;            var myInputText = TypeHere.val().substring(0, myInputLength - 1); // remove ','            TypeHere.width(myInputLength * 6 + 15);            //Check for email validation. //You can apply webservices for any type of validation.            var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;            if (myInputText.length == 0) {                TypeHere.val('');                return false;            }            if(!emailReg.test(myInputText)) {              alert('Email Is Invalid');              TypeHere.val('');              return false;            }            //Create the list item on fly and apply the css            CreateLi(myInputText)            //Save into Textbox or HiddenField            var strValue = txtValues.val() + myInputText + ';';            txtValues.val(strValue);            //Push the textbox to the right            TypeHere.width(myInputLength * 6 + 15);            //Make the input width to default and set as blank            liTypeHere.css('left', TypeHere.position().left + TypeHere.width() + 10);            TypeHere.val('');            TypeHere.width(10);            break;       }});

热点排行