我的日期字段HTML是
alert(checkRGB("rgb(0,0,300)"));
function checkRGB(input) {
var i, elem, validRGB;
validRGB = false;
// if input is within “rgb(”x,x,x“)“, should continue to execute
if((input.slice(0, 4) === "rgb(") && (input.slice(-1) === ")")) {
// Getting only "x, x, x," elements and make them array;
elem = input.slice(4, -1).split(",");
// Looping through array elements
for(i = 0; i < elem.length; i++) {
elem[i] = parseInt(elem[i]);
// if array elements > 0 and <= 255 , return true;
if((elem[i] >= 0 && elem[i] <= 255)) {
validRGB = true;
}
else
{
validRGB = false;
break;
}
}
}
return validRGB;
};
jsDate功能如下
<input class="form-control"type="text" name="txtOrderContractFinishDate" id="txtOrderContractFinishDate" ng-model="SelectedOrder.OrderContractFinishDate | jsDate | date:'MM/dd/yyyy'" placeholder="mm/dd/yyyy" />
日期从JSON日期格式转换为app.filter("jsDate", function () {
return function (x) {
return new Date(parseInt(x.substr(6)));
};
});
格式,没有任何问题。但是一旦显示数据后,如果我尝试编辑日期字段,则不允许我这样做。我是angularjs的新手。有人可以帮忙吗?