验证输入字符不应该是使用javascript的文本 [英] validating that enter character should not be text using javascript

查看:78
本文介绍了验证输入字符不应该是使用javascript的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本框,我希望该用户不能输入字符
仅使用Java脚本允许的数字值.我尝试将代码作为

函数checkforinteger(e)
{var a = document.getElementById("textbox1");
if(window.event)
{a = e.keycode
}

}

我也希望该用户在正确之前不能进入下一个文本框
错误.我认为可以使用onblur.但是我不知道如何使用javascript代码编写它.我对javascript .plz帮助非常陌生.还给了我一些提示,如果我按照

hi i have a textbox i want that user should not be able to enter character
only numeric value allowed using java script .i try the code as

function checkforinteger(e)
{var a=document.getElementById("textbox1");
if(window.event)
{a=e.keycode
}

}

also i want that user will not b able go to next textbox till he correct
the error.i think it is possible using onblur.but i dont know how to write it using javascript code .i m very very new to javascript .plz help. also give me some tips how can i improved my javascript with site should i follow

推荐答案

尝试创建一些Google的方法,该如何改善网站的JavaScript.比在这里等待答案更好.
将字段限制为仅数字 [ JavaScript教程 [ ^ ]
try to do some google. its better than waiting answer here.
Restricting a Field to Numbers Only[^]
This is the One of the best JavaScript tutorials in the Web.
JavaScript Tutorial[^]


这篇关于验证输入字符不应该是使用javascript的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆