JS全角字符转换为半角字符
function quanjiao2Banjiao(str) {
var i;
var result = '';
for (i = 0; i < str.length; i++) {
code = str.charCodeAt(i);
if (code >= 65281 && code < 65373) {
result += String.fromCharCode(str.charCodeAt(i) - 65248);
}
else {
result += str.charAt(i);
}
}
return result;
}
根据Iframe内容的高度设置Iframe的高度
function iframeResize()
{
try{
var f = document.frames('mainFrame');
var f1 = $('mainFrame');
if (f){
f.document.body.style.backgroundImage='url(../images/back.gif)';
var h = f.document.body.offsetHeight+100;
if(h < 500){
f1.height = 500;
}
else{
f1.height = h;
}
}
}
catch(e){}
}
pixelBottom 设置或获取对象的下方位置。
pixelHeight 设置或获取对象的高度。
pixelLeft 设置或获取对象的左侧位置。
ixelRight 设置或获取对象的右侧位置。
pixelTop 设置或获取对象的上方位置。
pixelWidth 设置或获取对象的宽度
许多有用的正则表达式
Email : /^/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*$/,
Phone : /^((/(/d{3}/))|(/d{3}/-))?(/(0/d{2,3}/)|0/d{2,3}-)?[1-9]/d{6,7}$/,
Mobile : /^((/(/d{3}/))|(/d{3}/-))?13/d{9}$/,
Url : /^http:////[A-Za-z0-9]+/.[A-Za-z0-9]+[//=/?%/-&_~`@[/]/':+!]*([^<>/"/"])*$/,
IdCard : /^/d{15}(/d{2}[A-Za-z0-9])?$/,
Currency : /^/d+(/./d+)?$/,
Number : /^/d+$/,
Zip : /^[1-9]/d{5}$/,
QQ : /^[1-9]/d{4,8}$/,
Integer : /^[-/+]?/d+$/,
Double : /^[-/+]?/d+(/./d+)?$/,
English : /^[A-Za-z]+$/,
Chinese : /^[/u0391-/uFFE5]+$/,
网上弄的东西不知道好不好用,有时间测试下!