javascript验证3
/*
限制输入字符的位数
str是用户输入字符串,len是要限制的位数
----------------------------
*/
function isSmall(str,len){
if (str.length<len){
return(true);
}else{
return(false);
}
}
/*判断两个字符串是否一致
---------------------------------
*/
function isSame(str1,str2){
if (str1==str2){
return(true);
}else{
return(false);
}
}
/*
判断字符串是否为空开始
---------------------------------
*/
function isNotNull(str){
if (str.length==""){
return(false);
}else{
return(true);
}
}
/*
判断是不是手机号码
---------------------------------
*/
function isPhone(str){
reg=/^[0]?13\d{9}$/gi;
reg2=/^[0]?15\d{9}$/gi;
if(!reg.test(str)&&!reg2.test(str)){
return false;
}
return true;
}
/*
判断用户名是否不包含汉字
(用户名不能为汉字,也不准带有特殊字符)
注:
正则表达式.test() 方法用于检测一个字符串是否匹配某个模式
---------------------------------
*/
function notChinese(str){
var reg=/[^A-Za-z0-9_]/g
if (reg.test(str)){
return (false);
}else{
return(true);
}
}
/*
判断是否为日期
----------------------------------
*/
function isDate (theStr) {
var the1st = theStr.indexOf('-');
var the2nd = theStr.lastInde
相关文档:
页面提交数据一般有两种方法:get,post。post就是所谓的form提交,使用视图;get是通过url提交。
Get方法一般用后台代码(如asp,asp.net)获得参数,代码很简单:Request.QueryString["id"];即可获取。
有些时候需要直接在前台获取url参数,要用到javascript,js没有直接获取url参数的方法,那么,我们如何通过js ......
javascript事件列表解说
事件 浏览器支持 解说
一般事件 onclick IE3、N2 鼠标点击时触发此事件
ondblclick IE4、N4 鼠标双击时触发此事件
onmousedown IE4、N4 按下鼠标时触发此事件
onmouseup IE4、N4 鼠标按下后松开鼠标时触发此事件
onmouseover IE3、N2 当鼠标移动到某对象范围的上方时触发此事件
onmou ......
JS Check:
javascriptlint http://www.javascriptlint.com/index.htm
jslint http://www.jslint.com/
JS UT:
http://www.jsunit.net/
JS ST:
http://www.outofhanwell.com/ieleak/index.php?title=Main_Page Drip
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
http://blogs.msdn. ......
Build your web applications quickly and easily using the industry leading web application IDE -- Aptana Studio.
Introduction:
Aptana Studio is a complete web development environment that combines powerful authoring tools for HTML, CSS, and JavaScript, along with thousands of additional plugins ......