求助手机号码提示效果 这个效果以前见过一回,现在有需要这个,请大家帮一下好吗?提供代码或提供网址都行的,谢谢!在文本框中输入手机号时,自动将号分段,如:输入13655556665 在框中提示136 5555 6665 这样的。如下图所示: 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 哈,有40分,我回复,但结贴率不高呢。alert("13655556666".replace(/^\d{3}|\d{4}/g, "$& ")) protected void Button1_Click(object sender, EventArgs e) { string a = this.TB1.Text; string b = a.Substring(0, 3) + " " + a.Substring(3, 4) + " " + a.Substring(7, 4); this.TB2.Text = b; } 我的两帖在“Web 开发 HTML(CSS)”版块置顶,所以没有结。那个代码可以写详细一些吗?本人不懂JS。就是在文本框中输入时,在另一个层中提示分段。可以写个详细的页面吗?如果可以,本人再加分 你这个代码可以写全一点吗?可以附上html吗 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title> New Document </title> </head> <body> <input type="text" value="" onkeyup="document.getElementById('msg').innerHTML = this.value.replace(/^\d{3}|\d{4}/g, '$& ')" /> <div id="msg" style="font:bold 12pt 宋体;color:#ff0000"></div> </body></html> <script type="text/javascript"> function js(x){ switch(x.value.length){ case 3:x.value+=" ";break; case 8:x.value+=" ";break; } } </script> <body> <input type="text" onkeyup="js(this);"/> </body> 再写个直接在文本框中自动分段的:<input type="text" onkeyup="this.value=this.value.replace(/^\d{3}(?=\d)|\d{4}(?=\d)/g, '$& ')"> 再给你写个分段提示的:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><style>.o{position:absolute;left:300px;top:200px}#x{position:relative;left:0px;top:0px;width:155px;height:22px;color:red;font:bold 12pt 黑体;text-align:center;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px;border:solid 1px red}#y{position:relative;left:25px;top:0px;width:0px;height:0px;border-top:solid 0px #fff;border-right:solid 5px #fff;border-bottom:solid 6px red;border-left:solid 5px #fff;}#d{position:relative;left:0px;top:2px;display:none}input:focus+#d, input:hover+#d{display:block;}</style><div class="o"><input type="text" onkeyup="document.getElementById('x').innerHTML=this.value.replace(/^\d{3}|\d{4}/g,'$& ')"><div id="d"><div id="y"></div><div id="x"></div></div></div> 上面没贴好,字串有断点,再贴:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><style>.o{position:absolute;left:300px;top:200px}#x{position:relative;left:0px;top:0px;width:155px;height:22px;color:red;font:bold 12pt 黑体;text-align:center;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px;border:solid 1px red}#y{position:relative;left:25px;top:0px;width:0px;height:0px;border-top:solid 0px #fff;border-right:solid 5px #fff;border-bottom:solid 6px red;border-left:solid 5px #fff;}#d{position:relative;left:0px;top:2px;display:none}input:focus+#d, input:hover+#d{display:block;}</style><div class="o"><input type="text" onkeyup="document.getElementById('x').innerHTML=this.value.replace(/^\d{3}|\d{4}/g,'$& ')"><div id="d"><div id="y"></div><div id="x"></div></div></div> apply的问题.求解..... jqtreetable 使用中问题 ! showModelessDialog大小动态设置,showModelessDialog大小随内容窗体大小变化 怎么做 兄弟们,帮我看看怎么做一个类似的页面。 求jquery如何根据某个属性的长度过滤数据?? for语句应用,请您解答,谢谢。 求支持中文的base64编码解码程序!!!!!!!!!!!!!!! VBScript函数调用的奇怪问题 请问一个表框填好后,能不能同时存入一个变量中? SVG元素 怎么引用.js? 气死我了! javascript 能否隐藏select
{
string a = this.TB1.Text;
string b = a.Substring(0, 3) + " " + a.Substring(3, 4) + " " + a.Substring(7, 4);
this.TB2.Text = b;
}
我的两帖在“Web 开发 HTML(CSS)”版块置顶,所以没有结。那个代码可以写详细一些吗?本人不懂JS。就是在文本框中输入时,在另一个层中提示分段。可以写个详细的页面吗?如果可以,本人再加分
你这个代码可以写全一点吗?可以附上html吗
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> New Document </title>
</head> <body>
<input type="text" value="" onkeyup="document.getElementById('msg').innerHTML = this.value.replace(/^\d{3}|\d{4}/g, '$& ')" />
<div id="msg" style="font:bold 12pt 宋体;color:#ff0000"></div>
</body>
</html>
<script type="text/javascript">
function js(x){
switch(x.value.length){
case 3:x.value+=" ";break;
case 8:x.value+=" ";break;
}
}
</script>
<body>
<input type="text" onkeyup="js(this);"/>
</body>
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
.o{position:absolute;left:300px;top:200px}
#x{position:relative;left:0px;top:0px;width:155px;height:22px;color:red;font:bold 12pt 黑体;text-align:center;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px;border:solid 1px red}
#y{position:relative;left:25px;top:0px;width:0px;height:0px;border-top:solid 0px #fff;border-right:solid 5px #fff;border-bottom:solid 6px red;border-left:solid 5px #fff;}
#d{position:relative;left:0px;top:2px;display:none}
input:focus+#d, input:hover+#d{display:block;}
</style>
<div class="o">
<input type="text" onkeyup="document.getElementById('x').innerHTML=this.value.replace(/^\d{3}|\d{4}/g,'$& ')">
<div id="d">
<div id="y"></div>
<div id="x"></div>
</div>
</div>
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
.o{position:absolute;left:300px;top:200px}
#x{position:relative;left:0px;top:0px;width:155px;height:22px;color:red;font:bold 12pt 黑体;text-align:center;line-height:22px;-moz-border-radius:5px;-webkit-border-radius:5px;border:solid 1px red}
#y{position:relative;left:25px;top:0px;width:0px;height:0px;border-top:solid 0px #fff;border-right:solid 5px #fff;border-bottom:solid 6px red;border-left:solid 5px #fff;}
#d{position:relative;left:0px;top:2px;display:none}
input:focus+#d, input:hover+#d{display:block;}
</style>
<div class="o">
<input type="text" onkeyup="document.getElementById('x').innerHTML=this.value.replace(/^\d{3}|\d{4}/g,'$& ')">
<div id="d">
<div id="y"></div>
<div id="x"></div>
</div>
</div>