大家好,我已经编写了一个javascript函数,其中我从后面的代码中传递了3个参数我的表单上有一个文本框、按钮和一个文本框,当光标位于第一个文本框内时,我会在离开文本框或单击按钮时喜欢从脚本中填充第二个文本框我在按钮内调用脚本如下
<script type="text/javascript">
function getEndDate2(noOfWeeks, sEmployeeWeeklyOfDay, DateStart) {
// My script code
}
<asp:TextBox ID="txtString" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="btnClick" runat="server" Text="Pass" OnClick="btnClick_Click" />
protected void btnClick_Click(object sender, EventArgs e)
{
int noOfweeks = Convert.ToInt16(txtString.Text);;
string sEmployeeWeeklyOfDay = "Friday";
string DateStart = DateTime.Now.AddDays(3).ToString();
btnClick.Attributes.Add("onClick", "getEndDate2('" + noOfweeks + "','" + sEmployeeWeeklyOfDay + "','" + DateStart + "');");
// Some code to insert the values to database
}
但是无法在第二个文本框中显示值有人可以帮助我如何在失去焦点后立即调用该脚本