我想要一个功能,用户可以在文本框中以下面的格式输入时间
InTime : hh:mm // In time of the employee 1st textbox
OutTime: hh:mm // Out Time of the employee 2nd textbox
第三个文本框
员工的总时间:这里的总数将来自两个文本框。
以下是我的HTML相同。请帮助
<tr>
<td>
<asp:Label ID="lblInTime" runat="server" Text="In Time" Visible="true"></asp:Label>
<asp:TextBox ID="txtInTime" runat="server" Width="50">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblOutTime" runat="server" Text="Out Time" Visible="true"></asp:Label>
<asp:TextBox ID="txtOutTime" runat="server" Width="50">
</asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblTotalHr" runat="server" Text="Total Hours" Visible="true"></asp:Label>
<asp:TextBox ID="txtTotalHrs" runat="server" Width="70" ReadOnly="true">
</asp:TextBox>
</td>
</tr>
答案 0 :(得分:0)
您可以使用 private final View myContentsView;
MyInfoWindowAdapter(){
myContentsView = getLayoutInflater().inflate(R.layout.custom_info_contents, null);
}
@Override
public View getInfoContents(Marker marker) {
//TODO getInfoContents
TextView tvTitle = ((TextView)myContentsView.findViewById(R.id.title));
tvTitle.setText(marker.getTitle());
TextView tvSnippet = ((TextView)myContentsView.findViewById(R.id.snippet));
tvSnippet.setText(marker.getSnippet());
// private static HashMap<String, MarkerOptions> mMapMarkers = null;
String landline = "";
String mobile = "";
String fax = "";
for (int i = 0; i < extraMarkerInfo.size(); i++) {
if (extraMarkerInfo.get(i).get("title").toString().equalsIgnoreCase(marker.getTitle()))
{
landline = extraMarkerInfo.get(i).get("landline").toString();
Log.i("get_Landline", landline);
mobile = extraMarkerInfo.get(i).get("mobile").toString();
Log.i("get_Mobile", mobile);
fax = extraMarkerInfo.get(i).get("fax").toString();
Log.i("get_Fax", fax);
}
}
TextView tvLandline = ((TextView)myContentsView.findViewById(R.id.landline_number));
tvLandline.setText(landline);
TextView tvMobile = ((TextView)myContentsView.findViewById(R.id.mobile_number));
tvMobile.setText(mobile);
TextView tvFax = ((TextView)myContentsView.findViewById(R.id.fax_number));
tvFax.setText(fax);
return myContentsView;
}
@Override
public View getInfoWindow(Marker arg0) {
// TODO Auto-generated method stub
return null;
}
}
来输入用户的时间。
TextMode="Time"
注意强>
<asp:TextBox ID="txtInTime" runat="server" Width="50" TextMode="Time"></asp:TextBox>
属性在asp.net 4.5及更高版本中可用,只有最新的浏览器才能识别,因为它将被转换为TextMode
输入标记
HTML5
答案 1 :(得分:0)
使用MaskedEditExtender
。
<cc1:MaskedEditExtender ID="meeInTime" runat="server" MaskType="Time"
Mask="99:99" MessageValidatorTip="true" ErrorTooltipEnabled="true" TargetControlID="txtInTime"
InputDirection="LeftToRight" AcceptNegative="Left">
</cc1:MaskedEditExtender>
总时间:
var InTime = "10:5";
var OutTime = "11.5";
TimeSpan ts = DateTime.Parse(OutTime )-DateTime.Parse(InTime );
double Hour = ts.TotalHours;
另一个选项
jquery控件。
它只是一个解决你问题的样本。