2008-03-11
javascript常用例子
1.判断是否为日期
//是否是日期格式
2.javascript中的提示确认对话框
3.javascript提交action
(1)提交带form的action
(2)提交不带form的action,可以说是个链接
4.html中的超链接提交
//是否是日期格式
function isDateString(sDate)
{
var iaMonthDays =[31,28,31,30,31,30,31,31,30,31,30,31]
var iaDate = new Array(3)
var year, month, day
if (arguments.length != 1) return false
iaDate = sDate.toString().split("-")
if (iaDate.length != 3) return false
if (iaDate[1].length > 2 || iaDate[2].length > 2) return false
year = parseFloat(iaDate[0])
month = parseFloat(iaDate[1])
day=parseFloat(iaDate[2])
if (year < 1900 || year > 2100) return false
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
if (month < 1 || month > 12) return false
if (day < 1 || day > iaMonthDays[month - 1]) return false
return true
}
2.javascript中的提示确认对话框
function rusure_agree()
{
question = confirm("是否确定批准该声请?")
if (question !="0")
{
document.v_AddVacationForm.action="v_ProcessVacation.do?vacation_id=<%=tv.getVacationId()%>";
document.v_AddVacationForm.submit();
}
}
3.javascript提交action
(1)提交带form的action
document.v_AddVacationForm.action="../../v_AddVacation.do"; document.v_AddVacationForm.submit();
(2)提交不带form的action,可以说是个链接
window.location.href="v_AddVacation.do";
4.html中的超链接提交
<a style="cursor: pointer" onclick="check();" >submit</a>
发表评论
- 浏览: 16661 次
- 性别:

- 来自: 成都

- 详细资料
搜索本博客
最近加入圈子
最新评论
-
关于struts2启动tomcat的 ...
在项目的src目录下创建struts.properties文件 再把这句话写在里 ...
-- by maoweiwer -
关于struts2启动tomcat的 ...
请问楼主,怎么创建???? 说详细些,谢谢. 初学者.
-- by tidelgl -
关于java.lang.ClassCastE ...
今天我也遇到了跟你一样的问题,找了半天,原来我在配置*.hhm.xml文件的时候 ...
-- by kylixlu -
关于java.lang.ClassCastE ...
汗,sofmit居然有这样的程序员,更没想到的是居然被我用google搜到
-- by san_yun -
关于java.lang.ClassCastE ...
大哥些 人呢 帮帮我吧 这个都捆饶我两天了 再不弄太可怜了
-- by fancool






评论排行榜