Text box to accept only number

head  runat="server">

<title></title>

<script language="javascript" type="text/javascript">

function CheckNumeric(e) {

if (window.event) // IE

{

if ((e.keyCode < 48 || e.keyCode > 57) & e.keyCode != 8) {

event.returnValue = false;

return false;

}

}

else { // Fire Fox

if ((e.which < 48 || e.which > 57) & e.which != 8) {

e.preventDefault();

return false;

}

}

}

</script>

</head>

<body>

<form id="form1" runat="server">

<asp:textbox id="TextBox1" runat="server" onkeypress="CheckNumeric(event);"

xmlns:asp="#unknown"></asp:textbox>

</form>

</body></head>

http://www.codeproject.com/Tips/306192/Text-box-to-accept-only-number

时间: 2024-08-04 19:41:09

Text box to accept only number的相关文章

C#: 向Word插入排版精良的Text Box

Text Box(文本框)是Word排版的工具之一.在Word文档正文的任何地方插入文本框,可添加补充信息,放在合适的位置,也不会影响正文的连续性.我们可以设置文本框的大小,线型,内部边距,背景填充等效果.文本框内可以图文混排,设置字体,字号,图片大小等. 在日常使用中,我们很容易忽略这些元素,仅仅插入一个黑色单线,仅含文字的文本框.因而,我觉得有必要向大家介绍并制作一个版式精良的文本框,抛砖引玉. 本篇博文主要介绍,如何使用C#在Word文档的特定位置,插入一个有图片填充,内部边距,图文混排,

cms.pod around line 457: Expected text after =item, not a number 的解决方法

如果在linux下安装openssl,执行config和make之后,在执行make install时如果出现下面的错误 cms.pod around line 457: Expected text after =item, not a number cms.pod around line 461: Expected text after =item, not a number cms.pod around line 465: Expected text after =item, not a n

Spring MVC-表单(Form)标签-文本框(Text Box)示例(转载实践)

以下内容翻译自:https://www.tutorialspoint.com/springmvc/springmvc_textbox.htm 说明:示例基于Spring MVC 4.1.6. 以下示例显示如何使用Spring Web MVC框架在窗体中使用文本框.首先,让我们使用Eclipse IDE,并按照以下步骤使用Spring Web Framework开发基于动态窗体的Web应用程序: 步骤 描述 1 创建一个名为HelloWeb的项目,在一个包com.tutorialspoint下,如

Change the indent between a list bullet or number and text

Keywords: Office Word Applies To: Word 2007 You can adjust the indents in a list to change how the list items line up. NOTE: For information about adjusting line spacing, see Adjust the spaces between lines or paragraphs. What do you want to do? Adju

SPOJ:Decreasing Number of Visible Box(不错的,背包?贪心?)

Shadowman loves to collect box but his roommates woogieman and itman don't like box and so shadowman wants to hide boxes as many as possible. A box can be kept hidden inside of another box if and only if the box in which it will be held is empty and

在Sublime Text 2中使用R语言

Using Sublime Text 2 for R Posted on May 17, 2012 by Tom Schenk Jr My R interface has been pretty basic in the last few years. I have usually stuck to the R console. Yes, I've triedEmacs with ESS; a staple, but it is so unbearably antiquated that I a

javaScript Number对象

Number 对象 Number 对象是原始数值的包装对象. 创建 Number 对象的语法: var myNum=new Number(value); var myNum=Number(value); Number 对象方法 1.toFixed  把数字转换为字符串,结果的小数点后有指定位数的数字. toFixed() 方法可把 Number 四舍五入为指定小数位数的数字. NumberObject.toFixed(num) 参数 描述 num 必需.规定小数的位数,是 0 ~ 20 之间的值

CSS3 box flex 布局

1.伸缩项目的布局方式-从左到右 <ul id="Layout1" class="box"> <li>1</li> <li>1</li> <li>1</li> </ul> .box{ width: 250px; padding: 10px; background: #999; margin: 10px; } .box li{ width: 100px; height: 1

sublime text 2 基于 MinGW 的 C/C++ 配置文件

之前按照网上的方法在 sunlime text 2 中配置了 C/C++ 开发环境,但是每次在菜单切换C和C++不同的编译配置,感觉很麻烦,折腾了下,自己按照个人喜好对配置文件做了点改动,最后结果如下: 快捷键说明: 运行: 在底部文本栏显示结果:Ctrl + , 在cmd窗口中显示结果:Ctrl + . C: 编译:Ctrl + Shift + B 编译并运行(在底部文本栏显示结果):Ctrl + Shift + , 编译并运行(在cmd窗口中显示结果):Ctrl + Shift + . C+