Posted by: c2win | November 19, 2011

How to validate start date and end date with javascript

Here is the javascript.

// enDate) {
alert(‘Start Date is greater than End Date!’);
document.getElementById(‘stDateTxt’).value = EDate;

}
else if (stDate != ”) {
var today = new Date();
if (stDate > today) {
alert(‘Select Date is greater than today!’);
document.getElementById(‘stDateTxt’).value = ”;
document.getElementById(‘stDateTxt’).focus();
}

}
}
function ValidateEndDate() {
var SDate = document.getElementById(‘stDateTxt’).value;
var EDate = document.getElementById(‘enDateTxt’).value;
var stDate = new Date(SDate);
var enDate = new Date(EDate);
if (stDate != ” && enDate != ” && enDate today) {
alert(‘Select Date is greater than today!’);
document.getElementById(‘enDateTxt’).value = ”;
document.getElementById(‘enDateTxt’).focus();
}
}
}

// ]]>

Server controls are here.

<form id=”form1″ runat=”server”>

<table>

<tr>

<td align=”right” style=”height: 28px; width: 90px;”>

<asp:Label ID=”lbDateFrom” runat=”server” Text=”Date From:”></asp:Label>

</td>

<td style=”width: 290px; height: 28px;”>

<asp:TextBox ID=”stDateTxt” runat=”server” Width=”85px” Test=”” MaxLength=”10″></asp:TextBox>

&nbsp;MM/dd/yyyy

</td>

</tr>

<tr>

<td align=”right” style=”height: 28px; width: 90px;”>

<asp:Label ID=”lbDateTo” runat=”server” Text=”Date To:”></asp:Label>

</td>

<td style=”width: 290px; height: 28px;”>

<asp:TextBox ID=”enDateTxt” runat=”server” Width=”85px” Text=”” MaxLength=”10″></asp:TextBox>

&nbsp;MM/dd/yyyy

</td>

</tr>

</table>

</form>

In code-behind,

protected void Page_Load(object sender, EventArgs e)

{

stDateTxt.Attributes.Add(“onblur”, “ValidateStartDate();”);

enDateTxt.Attributes.Add(“onblur”, “ValidateEndDate();”);

}

Javascript focus() property don’t work in Firefox. Thank!

Posted by: c2win | July 26, 2009

Zelaya returns to Honduras border

Mr Zelaya has vowed to keep up pressure on the interim government

Mr Zelaya has vowed to keep up pressure on the interim government

Exiled Honduran President Manuel Zelaya has returned to the country’s border with Nicaragua for the second day running, demanding to be allowed home.

He says he will set up camp on the Nicaraguan side to keep up pressure on the interim Honduran government.

Speaking into a megaphone, he demanded to be allowed to see his family, from whom he has been separated for a month.

On Friday, he made a symbolic crossing into Honduras but withdrew minutes later after being confronted by troops.

The US, which opposed Mr Zelaya’s dismissal and expulsion last month, has described his current attempts to return home as “reckless”.

Posted by: c2win | July 26, 2009

Swine flu service was ‘too late’

Swine flu service was 'too late'

New advertisements explain what anti-viral drugs are and how they can help

A Parliamentary committee is expected to criticise the government for being slow to set up a swine flu helpline.

The service for England was launched on Thursday but a House of Lords report is to attack ministers for not following their own timetable for pandemics.

More than 5,500 people got anti-viral drugs on day one of the flu line, which the government said was “working well”.

Meanwhile the health secretary has said undue anxiety about the mostly mild virus could put strain on the NHS.

In a report due out on Tuesday, peers on the Science and Technology Committee are expected to say ministers failed to follow their own timetable for informing and advising the public in the event of a pandemic.

Posted by: c2win | August 1, 2008

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Categories