javascript常用例子

1.判断是否为日期
//是否是日期格式
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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值