从子页面获取父页面的价值 [英] Get value in parent page from children page

查看:456
本文介绍了从子页面获取父页面的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!
我有一个问题,我可以将数据从子页面发送到父页面(在父页面中,我使用masterpage)并显示在标签上,但是当我想在背后的代码中获取价值时,我就无法获取它们.我得到的值始终是标签上的文本名称,我不知道为什么?
你能帮我吗?
这是我的javarscrip,用于将数据从子页面发送到父页面.

Hi every one!
I have a problem, i can send data from children page to parent page (in parent page i use masterpage ) and show on lable but when i want to get value in code behind i can''t get them. The value i get always the text name on my lable, i don''t know why?
Could u help me?
This my javarscrip to send data to parent page from children page.

function AcceptList() {
    opener.document.getElementById("ctl00_ContentPlaceHodlerMain_myIdLable").getAttribute.innerHTML = a;
    close();
    }


我使用.getAttribute.innerText是相同的结果.

[edit]已添加代码块-OriginalGriff [/edit]


i use .getAttribute.innerText is the same result.

[edit]Code block added - OriginalGriff[/edit]

推荐答案

Try
Try
opener.document.getElementById("ctl00_ContentPlaceHodlerMain_myIdLable").innerHTML = a;




or

opener.document.getElementById("ctl00_ContentPlaceHodlerMain_myIdLable").setAttribute("innerHTML", a);


您的方法不是专业的ctl00_ContentPlaceHodlerMain_myIdLable.为什么要使用渲染的ID. 无论如何,请尝试以下链接:
http://hspinfo.wordpress .com/2008/01/17/javascript-send-pass-value-of-child-window-to-parent-window/ [ http://www.roseindia.net/java/pass- value-example/pass-value-child-to-parent.shtml [ http://www.plus2net.com/javascript_tutorial/window-child3.php [ ^ ]
Your approach is not professional ctl00_ContentPlaceHodlerMain_myIdLable.Why you are using rendered ID.?
Anyway,try the following links:
http://hspinfo.wordpress.com/2008/01/17/javascript-send-pass-value-of-child-window-to-parent-window/[^]
http://www.roseindia.net/java/pass-value-example/pass-value-child-to-parent.shtml[^]
http://www.plus2net.com/javascript_tutorial/window-child3.php[^]


这篇关于从子页面获取父页面的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆