0
我在表單中給出了一個選擇選項並給出了它的值。 像 1.日常 2.Weekly 3.Monthly將「選擇」類型更改爲值更改時的「日期」類型
之後,我有另一種選擇option.I希望該選擇選項更改爲日期類型在第一場選擇「每月」選項。這可能嗎?
我的HTML代碼
<!--Select Data Range and the Frequency -->
<label class="labelColor"><h5><b>Select Data Range and the Frequency *</b></h5></label>
<div class="row">
<input style=width:100px placeholder="From Date" class="textbox-n" ng-model="fromDate" type="text" onfocus="(this.type='date')" id="date">
<input style=width:100px placeholder="To Date" class="textbox-n" ng-model="toDate" type="text" onfocus="(this.type='date')" id="date">
<select style=width:100px type="select" class="textbox-n" id="freq" ng-model="user.freq" ng-change="changeFields()" ng-disabled="isDisabled" ng-options="frequency.name for frequency in frequencysArr" name="freq">
<option id="default" value="" selected="selected">--Select--</option>
</select>
</div><br>
<!--Select Start Day -->
<label class="labelColor"><h5><b>Select Start Date *</b></h5></label><br>
<select style=width:100px type="select" class="textbox-n" id="startDate" ng-disabled="disableFields" ng-model="user.startDate" ng-options="date.name for date in datesArr" name="startDate">
<option id="default" value="" selected="selected">--Select--</option>
</select>
我的JS
$scope.frequencysArr = [{ "id": "1", "name": "Daily" }, { "id": "2", "name": "Weekly" }, { "id": "3", "name": "Monthly" }]
$scope.changeFields = function() {
if ($scope.user.freq.name == "Daily") {
$scope.disableFields = true;
}
else if ($scope.user.freq.name == "Weekly") {
$scope.disableFields = false;
$scope.datesArr = [{ "id": "1", "name": "Sunday" }, { "id": "2", "name": "Monday" }, { "id": "3", "name": "Tuesday" }, { "id": "3", "name": "Wednesday" }, { "id": "3", "name": "Thursday" }, { "id": "3", "name": "Friday" }, { "id": "3", "name": "Saturday" }]
}
else if ($scope.user.freq.name == "Monthly") {
}
};
所以基本上我想知道什麼碼我在去年否則,如果序改變我的選擇選項爲日期類型。
@Max - 你在諷刺什麼?這增加了什麼價值? – 2014-10-27 09:51:40
@Max - 沒關係,如果你不想幫助 – CraZyDroiD 2014-10-27 10:00:22
你是什麼意思「改變選擇日期類型」? IMO沒有日期選擇類型。只有一個類型爲「date」的輸入元素。 – DanEEStar 2014-10-27 10:18:05