jQuery手机数字框留空自动跳格特效代码下载


jQuery手机数字框留空自动跳格特效代码下载
jQuery手机数字框留空自动跳格特效代码下载以及手机数字框、留空自动跳格等js/jquery网页特效代码下载。

1. 引入CSS

<link href="css/style.css" rel="stylesheet">

2. 引入JS

<script src="js/jquery.min.js"></script>
<script src="js/alt_tabs.js"></script>
<script src="js/hzsoft-ui.js"></script>

3. HTML代码

<div class="db mt">
	<div class="searchNum" id="searchNum">
		<input type="tel" maxlength="1" value="1" readonly="readonly" autofocus="autofocus">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
		<input type="tel" maxlength="1" value="">
	</div>
	<div class="grayTxt">位数可留空</div>
</div>
<div class="btn-submit">确定</div>
<script type="text/javascript">
var organizeId = request('organizeId');
var city = request('city');
$("#searchNum input").keyup(function(event) {
	switch (event.which) {
		case 8: //back
			$(this).prev().focus();
			break;
		case 37: //left
			$(this).prev().focus();
			break;
		case 39: //right
			$(this).next().focus();
			break;
		default:
			var t = $(this).val();
			var reg = /[\d]/g;
			if (reg.test(t)) {
				$(this).next().focus();
			} else {
				t = t.replace(/[^\d]/g, '');
				$(this).val(t);
			}
			break;
	}
});
function searchBykw() {
	var _kw = '';
	if ($("#kwtit1").hasClass('cur')) {
		_kw = $("#kw").val();
		if (_kw != '') {
			if ($("#cbIsEnd").is(':checked')) {
				_kw += "|";
			}
		}
	} else {
		var o = document.getElementById('searchNum').getElementsByTagName('input');
		for (i = 0; i < o.length; i++) {
			if (o[i].value == '') {
				_kw += '*';
			} else {
				_kw += o[i].value;
			}
		}
	}
	if (_kw != '' && _kw != '1__________') {
		//do search
		//keyword = _kw; 下边一行代码就是设置需要跳转的页面
		//location.href = 'list?keyword=' + _kw + "&organizeId=" + organizeId + "&city=" + city;
	} else {
	}
	alert(_kw)
}
$(".btn-submit").click(function() {
	searchBykw();
})
$(document).ready(function() {
	$('.alt-tabs').alt_tabs({
		action: 'click'
	});
});
</script>

相关推荐

发表评论

相关文章