限制文本框只能输入数字,而且不能粘贴非数字的值:

onkeypress="return event.keyCode>=48&&event.keyCode<=57″ 
onpaste="var s=clipboardData.getData(’text’); if(!/D/.test(s)) value=s.replace(/^0*/,"); return false;" ondragenter="return false"

—-2009/02/27

Tags:

Related posts

Tags: .
Home

No Comments Now!

Be the first to comment on this entry.

Leave a comment

Name(required)
Mail (required),(will not be published)
Website(recommended)

Fields in bold are required. Email addresses are never published or distributed.

Some HTML code is allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
URLs must be fully qualified (eg: http://hanghang.name),and all tags must be properly closed.

Line breaks and paragraphs are automatically converted.

Please keep comments relevant. Off-topic, offensive or inappropriate comments may be edited or removed.