String.prototype.Trim = function(){ return Trim(this);}
String.prototype.LTrim = function () { return LTrim(this); }
String.prototype.RTrim = function () { return RTrim(this); }
function LTrim(str) {
var i;
for (i = 0; i < str.length; i++) {
if (str.charAt(i) != " " && str.charAt(i) != " ") break;
}
str = str.substring(i, str.length);
return str;
} function RTrim(str) {
var i;
for (i = str.length - 1; i >= 0; i--) {
if (str.charAt(i) != " " && str.charAt(i) != " ") break;
}
str = str.substring(0, i + 1);
return str;
} function Trim(str) {
return LTrim(RTrim(str));
}
<html>
<head>
<title>RegTest</title>
<script type="text/javascript" language="javascript">
//这是验证:YYYY-MM-DD格式
function oneclick() {
//var reg = /^d{4}/d{1,2}/d{1,2}$/;
var reg = /^[1-9]d*.d*|[1-9]d*|0.d*[1-9]d*$/;
if(reg.test(1))
{ alert('日期格式正确!'); }
else { alert('日期格式不正确!'); }
}
//这是验证:DD-MM-YYYY格式
function dateCheck(str) {
var re = new RegExp("^([0-9]{1,2})[.-]{1}([0-9]{1,2})[.-]{1}([0-9]{4})$");
return re.exec(str);
}
</script>
</head>
<body>
<center>
<input type="text" value="" name="va" id="va"/>
<input type="button" value="ccccc" onclick="oneclick();" />
</center>
</body>
</html>
$(function () {
$("#btnUP").click(function () {
AjaxSubmit("Ajax/AjaxUpload.aspx", "form1", { fileBox: "<%=ID%>", fileName: "Bg" }, function (data) {
parent._call2(data);
});
});
$("#btnBannerUp").click(function () {
AjaxSubmit("Ajax/AjaxUpload.aspx", "form1", { fileBox: "<%=ID%>", fileName: "Banner" }, function (data) {
parent._call3(data);
});
});
$("#btnAddFit").click(function () {
var bgColor = $("#bgColor").val();
var bgUrl = $("#bgHideUrl").val();
var bannerUrl = $("#bannerHideUrl").val();
$.ajax({
url: "Ajax/AjaxUpload.aspx",
async: true, cache: false,
data: {
action: 1,
bgUrl: bgUrl,
bannerUrl: bannerUrl,
bgColor: bgColor,
zxId:"",
shopId: "<%=shopInfo.ShopID%>"
},
success: function (data) {
alert(data);
}
});
});
});