window.opener.document.forms(0).abcd.value为null或不是对象 [英] window.opener.document.forms(0).abcd.value is null or not an object
问题描述
我在父页面中使用母版页.
当我打开子页面并使用下面的代码
window.opener.document.forms(0).abcd.value为null或不是对象
Hi,
I''m using master page in the parent page.
When I''m opening the child page and use the below code
window.opener.document.forms(0).abcd.value is null or not an object
string strScript = "<script>window.opener.document.forms(0).abcd.value" + " = '" + textbox1.text + "';";
strScript += "self.close()";
strScript += "</" + "script>";
RegisterClientScriptBlock("abcd", strScript);
我也用过
1. window.document.getElementById(''abcd'').value
2. window.opener.document.forms [0] .abcd.value
3. window.opener.document.forms [''form1''].elements [''abcd''].value
4. window.opener.document.forms [0] .elements [''abcd''].value
5. self.opener.document.abcd.value
代替
window.opener.document.forms(0).abcd.value
但是他们俩都不为我工作
请帮助我
提前谢谢.
Rahul
I have also used the
1. window.document.getElementById(''abcd'').value
2. window.opener.document.forms[0].abcd.value
3. window.opener.document.forms[''form1''].elements[''abcd''].value
4. window.opener.document.forms[0].elements[''abcd''].value
5. self.opener.document.abcd.value
instead of
window.opener.document.forms(0).abcd.value
but neither of them worked for me
Please help me on this
Thanks in advance.
Rahul
推荐答案
亲爱的朋友
而不是使用document.forms(0).abcd.value
使用
Dear Friend
Instead of using document.forms(0).abcd.value
use
<pre lang="midl">document.getElementById(''myText'').value;</pre><br />
,因为它会为您提供更精确的结果
您还可以将函数返回的值分配给变量并对其执行操作
例如:-
as it will give you more precise result
you can also assign the value returned by the function to a variable and perform operation on it
eg:-
var DivValue=document.getElementById(''DivValue'');
alert(DivValue);
问候
Vipin Kumar Mallaya
Regards
Vipin Kumar Mallaya
大家好
问题已解决
我从文本框中删除了runat ="server"标签,并使用了
window.opener.document.getElementById(''abcd'').value
代替
window.opener.document.forms(0).abcd.value
Hi All
The problem is resolved
where i removed the runat="server" tag from the text box and uses
window.opener.document.getElementById(''abcd'').value
instead of
window.opener.document.forms(0).abcd.value
这篇关于window.opener.document.forms(0).abcd.value为null或不是对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!