读书人

text中不能输入汉字及div在同一行有关

发布时间: 2012-08-21 13:00:21 作者: rapoo

text中不能输入汉字及div在同一行问题
1、校验text中不能含有汉字及引号
function isValidate(obj,id,val){
var txt = document.getElementById(id);
if((/[\u4e00-\u9fa5]+/).test(obj)){
alert("不能含有汉字!");
txt.value=val;
txt.focus();
}
if((/["]|[']|[“]|[”]|[‘]|[’]+/).test(obj)){
alert("不能含有引号!");
txt.value=val;
txt.focus();
}
}

2、关于2个div标签在同一行问题
在标签中加入style="display:inline;"

读书人网 >Web前端

热点推荐