js查询区号时差代码怎么写
js实现区号时差的方法,js查询区号时差代码怎么写代码教程如下:
输入要查询的国际
计算结果:显示该区域电话区号,时差
js实现代码:
var Public = {};
Public.TableSearch = function (table, keyword) {
if (keyword) {
keyword = keyword.replace(/\s+/g, '');
}
if (!keyword) {
$('tr', table).each(function () {
$(this).show();
});
return;
}
var pattern = new RegExp(keyword), is_show = false, is_td = false, str = '';
$('tr', table).each(
function () {
is_show = false, is_td = false;
$('td', this).each(
function () {
is_td = true;
str = $(this).text().replace(/\s+/g, '');
if (pattern.test(str)) {
is_show = true;
}
}
);
if (is_td) {
if (is_show) {
$(this).show();
}
else {
$(this).hide();
}
}
}
);
}
显示效果:时差查询
参考文章:http://www.itmacom.com/gl/33459.html
常用工具