我有一个javascript函数,如果用户选择未来日期,则会出现一个弹出窗口,该弹出窗口将包含一个文本框和一个按钮。用户在文本框中输入值并单击子弹出按钮.我想在父窗口中捕获这些值,但我无法做到。
下面是我写的javascript:-
function CheckDateEalier(sender, args)
{
var toDate = new Date();
toDate.setMinutes(0);
toDate.setSeconds(0);
toDate.setHours(0);
toDate.setMilliseconds(0);
if (sender._selectedDate < toDate)
{
alert("You can't select day earlier than today! In Case if you are selecting Previous date then, By default it will take current Date.");
sender._selectedDate = toDate;
//set the date back to the current date
sender._textbox.set_Value(sender._selectedDate.format(sender._format))
}
if (sender._selectedDate > toDate) {
var timeSpent = window.open("EnterTimeSpent.aspx", "List", "scrollbars=no,resizable=no,width=320,height=100");
document.getElementById('<%= hiddenFieldFutureDateSelectTimeSpent.ClientID%>').value = timeSpent;
}
}
子页面上的javascript:-
<script language="javascript" type="text/javascript">
function Parent() {
var timespent = Input.elements["timespent"].value;
//window.opener.UpdateValues(3);
window.returnValue = timespent;
self.close();
}
后面的子页面代码:-
<form name="Input" method="post" action="">
<table>
<tr>
<td><input type="text" name="timespent" style="font-size:small;font-weight:bold;"></input>
</tr>
<tr>
<td>
<input type="button" value="Submit" class="button small green rounded" onClick="Parent()"></input>
</td></tr>
</table>
</form>
当我调试时,我发现在父页面上,我无法捕获从孩子发送的时间,它显示为对象。请帮我看看我在做什么错误以及我如何捕获文本框的值父页面中的子页面。