通过 javascript 将值从子页面返回到父页面时面临的问题.它正在返回对象,我想要值
Issue facing while returning values from child to parent page via javascript. It is returning object and i want the value
我有一个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>
当我在调试时,我发现在父页面上,我无法捕获从孩子发送所花费的时间,它将其显示为对象。请帮助我弄清楚我正在犯的错误以及我如何在父级中捕获子页面文本框的值。
为什么不使用已经具有此功能的"提示";
var t=prompt("timespent",");
如果你需要样式,你可以使用jprompt(http://www.abeautifulsite.net/blog/2008/12/jquery-alert-dialogs)
相关文章:
- 为变量分配多个nodejs导出返回值时出现问题
- 将数据加载到使用JSON返回的表单字段时出现问题
- async问题,JS Promise无法返回结果,但可以使用console.log
- Jquery函数返回订单问题
- 将一个php变量从js传递到php,并返回内容问题
- javasctipt-返回值的异步问题
- 嵌套异步函数未及时返回数据的问题
- 使用 GitHub API 在 dojo 中执行 PUT 更新会返回 400:解析 JSON 时出现问题
- 从ID Jquery类获取返回值时出现问题
- 从表单javascript返回值时出现问题
- Safari浏览器返回按钮问题
- jquery$.ajax使用返回数据时出现问题
- 存在从函数返回值的问题
- 将clientWidth/clientHeight Javascript与webgl一起使用会返回问题
- javascript函数返回问题
- 在函数中提示未定义返回.(问题)范围
- 从Javascript文件调用Rest API:数据返回问题
- 变量作用域或返回问题(不确定是哪个)
- JavaScript返回问题
- chrome.extension.getViews()返回问题