//让文本框内只能输入英文和数字
<input οnkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
function onlychinese(){
if ((window.event.keyCode >=32) && (window.event.keyCode <= 126)){
window.event.keyCode = 0;
}
}
function onlyenglish(){
if (window.event.keyCode <=64){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 123){
window.event.keyCode = 0;
}
}
function onlyenglish2(){
if (window.event.keyCode <=47){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 123){
window.event.keyCode = 0;
}
}
function onlynumber(){
if (window.event.keyCode <=47){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 57){
window.event.keyCode = 0;
}
}
function verifyAddress(obj) {
var email = obj.email.value;
var pattern =/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
return true;
}else{
alert("请填写正确的邮箱地址!");
return false;
}
}
<input οnkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
function onlychinese(){
if ((window.event.keyCode >=32) && (window.event.keyCode <= 126)){
window.event.keyCode = 0;
}
}
function onlyenglish(){
if (window.event.keyCode <=64){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 123){
window.event.keyCode = 0;
}
}
function onlyenglish2(){
if (window.event.keyCode <=47){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 123){
window.event.keyCode = 0;
}
}
function onlynumber(){
if (window.event.keyCode <=47){
window.event.keyCode = 0;
}
if (window.event.keyCode >= 57){
window.event.keyCode = 0;
}
}
function verifyAddress(obj) {
var email = obj.email.value;
var pattern =/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
flag = pattern.test(email);
if(flag)
{
return true;
}else{
alert("请填写正确的邮箱地址!");
return false;
}
}