怎么样保证在表单中输入的字符只能是数字的,谢谢了,给分! <input onkeyup='value=value.replace(/[^0-9]/,"")'> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0028)http://3http.com/js/1/01.htm --><HTML><HEAD><META http-equiv=Content-Type content="text/html; charset=unicode"><META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD><IE:DOWNLOAD id=oDownload style="BEHAVIOR: url(#default#download)" /><HEAD><LINK href="只允许输入数字.files/03.css" type=text/css rel=stylesheet></HEAD><BODY><TEXTAREA id=ok2 rows=7 cols=100></TEXTAREA> <DIV align=center><INPUT onmousedown=runEx() title="???????<input" onclick="ok2.select();document.execCommand('Copy')" type=image src="只允许输入数字.files/02.gif"><DIV id=wri></DIV><SCRIPT>function onDownloadDone(n){ok2.value=nsetTimeout('asdfasf23(ok2.value)',500)}oDownload.startDownload(location.hash.substr(1)+".htm",onDownloadDone)function asdfasf23(n){var re;//re=/ (\d+)>/g;n=n.replace(re,"`vs2`#ff0000 $1>`1`1")re=/<script(\s*\S*\s*\S*)>/gi;n=n.replace(re,"`vS2`#0000ff><script$1>`1`1")re=/<\/script>/gi;n=n.replace(re,"`vS2`#0000ff></"+"script>`1`1")re=/<body/gi;n=n.replace(re,"`vS2`\"\"style=\"background-color:#99CCFF\"><body`1`1")re=/<\/body>/gi;n=n.replace(re,"`vS2`\"\"style=\"background-color:#99CCFF\"></body>`1`1")re=/(var|if|else|for)/g;n=n.replace(re,"`vS2`#0000ff>$1`1`1")re=/(function\s\S+\s*\(\S*\)|{|})/g;n=n.replace(re,"`vS2`#ff0000>$1`1`1")re=/(\(|\))/g;n=n.replace(re,"`vS2`#f00fff>$1`1`1")re=/\/\/(\S*)/g;n=n.replace(re,"`vS2`#00aa00>\/\/$1`1`1")re=/</g;n=n.replace(re,"<")re=/\n/g;n=n.replace(re,"<br>")re=/`vS2`/g;n=n.replace(re,"<font color=")re=/`1`1/g;n=n.replace(re,"<\/font>")wri.innerHTML=n}function runEx(){var winEx=window.open("", "winEx","status=yes,menubar=yes,scrollbars=yes,resizable=yes");winEx.document.open("text/html","replace");winEx.document.write(ok2.value);winEx.document.close()}</SCRIPT></DIV></BODY></HTML> <input type=text size=8 onkeyup=math3(this) onBlur=math3(this)><script>function math3(n){n.value=n.value.replace(/\D/g,'')}</script> <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="GENERATOR" content="Microsoft FrontPage 4.0"><meta name="ProgId" content="FrontPage.Editor.Document"><title>只输入数字的几种方法</title><style>td{font-size:12px}</style></head><body><table border="1" width="90%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF"> <tr> <td width="100%"><input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"> <br> try:<input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td> </tr> <tr> <td width="100%"><input name=txt1 onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"><br> try:<input name=txt1 onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"></td> </tr> <tr> <td width="100%"><input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"><br> try:<input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"></td> </tr> </table></body></html> MzTreeView梅花雪树问题 小妹新手,想请教js问题 用j2ee来执行servlet,缺省的端口号是8080还是8000 寻求JavaScript高手合作 javascript基础东东,请教下。 replace问题,有换行为什么替换不了? 关于图片的按钮的问题,问题详细见帖中,多谢各位! BaseTrim.arguments.length==2这句是什么意思? 关于this.form问题 IFRAME在IE6下的显示问题 关于loading的问题 自己写的javascrip函数里可以调用.java文件并返回参数吗??
<!-- saved from url=(0028)http://3http.com/js/1/01.htm -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD><IE:DOWNLOAD
id=oDownload style="BEHAVIOR: url(#default#download)" /><HEAD><LINK
href="只允许输入数字.files/03.css" type=text/css rel=stylesheet></HEAD>
<BODY><TEXTAREA id=ok2 rows=7 cols=100></TEXTAREA>
<DIV align=center><INPUT onmousedown=runEx() title="???????<input"
onclick="ok2.select();document.execCommand('Copy')" type=image
src="只允许输入数字.files/02.gif">
<DIV id=wri></DIV>
<SCRIPT>
function onDownloadDone(n){
ok2.value=n
setTimeout('asdfasf23(ok2.value)',500)
}
oDownload.startDownload(location.hash.substr(1)+".htm",onDownloadDone)function asdfasf23(n){
var re;
//re=/ (\d+)>/g;n=n.replace(re,"`vs2`#ff0000 $1>`1`1")
re=/<script(\s*\S*\s*\S*)>/gi;n=n.replace(re,"`vS2`#0000ff><script$1>`1`1")
re=/<\/script>/gi;n=n.replace(re,"`vS2`#0000ff></"+"script>`1`1")
re=/<body/gi;n=n.replace(re,"`vS2`\"\"style=\"background-color:#99CCFF\"><body`1`1")
re=/<\/body>/gi;n=n.replace(re,"`vS2`\"\"style=\"background-color:#99CCFF\"></body>`1`1")
re=/(var|if|else|for)/g;n=n.replace(re,"`vS2`#0000ff>$1`1`1")
re=/(function\s\S+\s*\(\S*\)|{|})/g;n=n.replace(re,"`vS2`#ff0000>$1`1`1")
re=/(\(|\))/g;n=n.replace(re,"`vS2`#f00fff>$1`1`1")
re=/\/\/(\S*)/g;n=n.replace(re,"`vS2`#00aa00>\/\/$1`1`1")re=/</g;n=n.replace(re,"<")
re=/\n/g;n=n.replace(re,"<br>")
re=/`vS2`/g;n=n.replace(re,"<font color=")
re=/`1`1/g;n=n.replace(re,"<\/font>")
wri.innerHTML=n
}
function runEx(){
var winEx=window.open("", "winEx","status=yes,menubar=yes,scrollbars=yes,resizable=yes");
winEx.document.open("text/html","replace");winEx.document.write(ok2.value);winEx.document.close()}
</SCRIPT>
</DIV></BODY></HTML>
function math3(n){
n.value=n.value.replace(/\D/g,'')
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>只输入数字的几种方法</title>
<style>
td{font-size:12px}
</style>
</head><body><table border="1" width="90%" bordercolor="#000000" cellspacing="0" cellpadding="0" bordercolorlight="#000000" bordercolordark="#FFFFFF">
<tr>
<td width="100%"><input onkeyup="this.value=this.value.replace(/\D/g,'')"
onafterpaste="this.value=this.value.replace(/\D/g,'')">
<br>
try:<input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"></td>
</tr>
<tr>
<td width="100%"><input name=txt1 onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"><br>
try:<input name=txt1 onchange="if(/\D/.test(this.value)){alert('只能输入数字');this.value='';}"></td>
</tr>
<tr>
<td width="100%"><input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"><br>
try:<input onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"></td>
</tr>
</table></body></html>